如果系统环境崩溃。 调用/usr/bin/vim /etc/profile
1 网络搭建
2 host配置
3 SSH无密码登录
4 rpm 安装
yum install rpm
5 JDK安装
《《 一定要先删除JDK!!!!!!》》
1) open JDK都说有问题 我来试试 试了之后 Open JDK果然有问题。 在HDFS初始化时候不给力。
最好还是先卸载掉openjdk,在安装sun公司的jdk.先查看 rpm -qa | grep java
显示如下信息:
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
卸载:
rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
还有一些其他的命令
rpm -qa | grep gcj
rpm -qa | grep jdk
如果出现找不到openjdk source的话,那么还可以这样卸载
yum -y remove java java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
yum -y remove java java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
2) chmod 777 jdk-7u76-linux-x64.rpm
3) rpm -i jdk-7u76-linux-x64.rpm
1)yum -y list java*
2)yum -y install java-1.7.0-openjdk.x86_64
6 MySQL安装
1)yum -y list mysql
2)yum -y install mysql.x86_64
数据库字符集设置 mysql配置文件/etc/my.cnf中加入default-character-set=utf8启动mysql服务: service mysqld start或者/etc/init.d/mysqld start开机启动: chkconfig -add mysqld,查看开机启动设置是否成功chkconfig --list | grep mysql*mysqld 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭停止: service mysqld stop
3)登录
创建root管理员: mysqladmin -u root password 123456登录: mysql -u root -p输入密码即可。忘记密码: service mysqld stop
mysqld_safe --user=root --skip-grant-tables
mysql -u root use mysql update user set password=password("new_pass") where user="root"; flush privileges; 5.4)远程访问
开放防火墙的端口号mysql增加权限:mysql库中的user表新增一条记录host为“%”,user为“root”。
5、Linux MySQL的几个重要目录
数据库目录 /var/lib/mysql/配置文件 /usr/share /mysql(mysql.server命令及配置文件)相关命令 /usr/bin(mysqladmin mysqldump等命令)启动脚本 /etc/rc.d/init.d/(启动脚本文件mysql的目录)
mysql安装
5.1) yum install -y mysql-server mysql mysql-deve
5.2) service mysqld stop
5.3) vi /etc/my.conf
[mysqld]
transaction-isolation=READ-COMMITTED
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
key_buffer = 16M
key_buffer_size = 32M
max_allowed_packet = 32M
thread_stack = 256K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
max_connections = 550
# log_bin should be on a disk with enough free space
# NOTE: replace '/x/home/mysql/logs/binary' below with
# an appropriate path for your system.
log_bin=/usr/local/mysql/mysql/logs/binary/mysql_binary_log
# For MySQL version 5.1.8 or later. Comment out binlog_format for older versions.
binlog_format = mixed
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
# InnoDB settings
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_buffer_pool_size = 1G
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
key_buffer = 16M
key_buffer_size = 32M
max_allowed_packet = 32M
thread_stack = 256K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
max_connections = 550
# log_bin should be on a disk with enough free space
# NOTE: replace '/x/home/mysql/logs/binary' below with
# an appropriate path for your system.
log_bin=/usr/local/mysql/mysql/logs/binary/mysql_binary_log
# For MySQL version 5.1.8 or later. Comment out binlog_format for older versions.
binlog_format = mixed
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
# InnoDB settings
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_buffer_pool_size = 1G
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
// 创建日志文件并修改权限。
5.4) mkdir -p /usr/local/mysql/mysql/logs/binary/mysql_binary_log
5.5) chown mysql /usr/local/mysql/mysql/logs/binary/mysql_binary_log
5.6) sudo -u mysql touch /usr/local/mysql/mysql/logs/binary/mysql_binary_log/mysql_binary_log.index
// 启动 mysql 并完成配置
5.7) service mysqld start;
7 jdk 位置
7.1)rpm -qa | grep jdk
7.2)rpm -ql java-1.7.0-openjdk-1.7.0.79-2.5.5.3.el6_6.x86_64
/usr/java/jdk1.7.0_76
8 jdk环境变量
8.1) vi /etc/profile
8.2)
export JAVA_HOME=/usr/java/jdk1.7.0_76
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
Hadoop没有安装之前如果用下面的东西加入profile 会导致profile坏死
JAVA_HOME=/usr/java/jdk1.7.0_76
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:PATH
export JAVA_HOME
export PATH
export CLASSPATH
God has given me a gift. Only one. I am the most complete fighter in the world. My whole life, I have trained. I must prove I am worthy of someting.
rocky_24