#安装JDK
1、查看系统是否安装JDK,并卸载
rpm -qa | grep java tzdata-java-2013g-1.el6.noarch java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64 java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
2、删除软件包
rpm -e --nodeps tzdata-java-2013g-1.el6.noarch rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64 rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
3、将jdk-6u35-linux-x64.bin复制到/usr/local/java目录下(mkdir Java)
chmod +x jdk-6u35-linux-x64.bin ./jdk-6u35-linux-x64.bin
4、配置环境变量
vi /etc/profile
JAVA_HOME=/usr/local/java/jdk1.6.0_35 JRE_HOME=/usr/local/java/jdk1.6.0_35/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export JAVA_HOME JRE_HOME PATH CLASSPATH
#:wq
5、加载环境变量
source /etc/profile
6、测试是否安装成功
Java -version java version "1.6.0_35" Java(TM) SE Runtime Environment (build 1.6.0_35-b10) Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)
#安装成功。
#安装tomcat
7、将apache-tomcat-6.0.35复制到/usr/local/tomcat/(mkdir tomcat)
8、解压
tar zxvf apache-tomcat-6.0.35.tar.gz
9、把tomcat安装成系统服务
cd /etc/init.d vi tomcat #!/bin/bash # description: Tomcat Start Stop Restart # processname: tomcat # chkconfig: 234 20 80 JAVA_HOME=/usr/local/java/jdk1.6.0_35 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH CATALINA_HOME=/usr/local/tomcat/apache-tomcat-6.0.35 case $1 in start) sh $CATALINA_HOME/bin/startup.sh ;; stop) sh $CATALINA_HOME/bin/shutdown.sh ;; restart) sh $CATALINA_HOME/bin/shutdown.sh sh $CATALINA_HOME/bin/startup.sh ;; esac exit 0
#:wq
将tomcat添加到系统服务
chmod 755 tomcat chkconfig --add tomcat chkconfig --level 2345 tomcat on chkconfig --list tomcat
10、测试是否成功
service tomcat start Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-6.0.35 Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-6.0.35 Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-6.0.35/temp Using JRE_HOME: /usr/local/java/jdk1.6.0_35 Using CLASSPATH: /usr/local/tomcat/apache-tomcat-6.0.35/bin/bootstrap.jar service tomcat restart Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-6.0.35 Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-6.0.35 Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-6.0.35/temp Using JRE_HOME: /usr/local/java/jdk1.6.0_35 Using CLASSPATH: /usr/local/tomcat/apache-tomcat-6.0.35/bin/bootstrap.jar Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-6.0.35 Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-6.0.35 Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-6.0.35/temp Using JRE_HOME: /usr/local/java/jdk1.6.0_35 Using CLASSPATH: /usr/local/tomcat/apache-tomcat-6.0.35/bin/bootstrap.jar service tomcat stop Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-6.0.35 Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-6.0.35 Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-6.0.35/temp Using JRE_HOME: /usr/local/java/jdk1.6.0_35 Using CLASSPATH: /usr/local/tomcat/apache-tomcat-6.0.35/bin/bootstrap.jar service tomcat start Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-6.0.35 Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-6.0.35 Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-6.0.35/temp Using JRE_HOME: /usr/local/java/jdk1.6.0_35 Using CLASSPATH: /usr/local/tomcat/apache-tomcat-6.0.35/bin/bootstrap.jar
#安装成功
#安装MYSQL
11、安装cmake所需依赖包
yum -y install gcc libxml2-dev curl screen libpng12-dev autoconf libpcre3-dev make bzip2 libevent-dev patch libjpeg62-dev libcurl4-openssl-dev libfreetype6-dev g++ libtool libncurses5-dev psmisc lrzsz gcc-c++ ncurses-devel
12、复制到服务器相关目录下
tar zxvf cmake-2.8.5.tar.gz cd cmake-2.8.5 ./boostarp #./configure make #时间有点长 make install cmake -version #cmake version 2.8.5
13、将cmake永久加入系统环境变量
vi /etc/profile PATH=/usr/local/cmake-2.8.10.2/bin:$PATH export PATH
#:wq source /etc/profile #立即生效
14、创建mysql的安装目录机数据库存放目录
mkdir -p /usr/local/mysql mkdir -p /usr/local/mysql/data
15、创建mysql用户及用户组
groupadd mysql useradd -r -g mysql mysql
16、编译安装mysql
tar zxvf mysql-5.5.17.tar.gz cd mysql-5.5.17 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306
make && make install
17、检查是否安装成功
cd /usr/local/mysql ll total 76 drwxr-xr-x. 2 mysql mysql 4096 Dec 4 00:03 bin -rw-r--r--. 1 mysql mysql 17987 Oct 12 2011 COPYING drwxr-xr-x. 5 mysql mysql 4096 Dec 4 00:18 data drwxr-xr-x. 2 mysql mysql 4096 Dec 4 00:03 docs drwxr-xr-x. 3 mysql mysql 4096 Dec 4 00:03 include -rw-r--r--. 1 mysql mysql 7604 Oct 12 2011 INSTALL-BINARY drwxr-xr-x. 3 mysql mysql 4096 Dec 4 00:03 lib drwxr-xr-x. 4 mysql mysql 4096 Dec 3 23:24 man srwxrwxrwx. 1 mysql mysql 0 Dec 4 00:18 mysql.sock drwxr-xr-x. 10 mysql mysql 4096 Dec 3 23:24 mysql-test -rw-r--r--. 1 mysql mysql 2552 Oct 12 2011 README drwxr-xr-x. 2 mysql mysql 4096 Dec 3 23:24 scripts drwxr-xr-x. 27 mysql mysql 4096 Dec 3 23:24 share drwxr-xr-x. 4 mysql mysql 4096 Dec 4 00:03 sql-bench drwxr-xr-x. 2 mysql mysql 4096 Dec 4 00:03 support-files
#安装成功
18、设置mysql 目录权限
cd /usr/local/mysql
#把当前目录中所有文件的所有者设为root,所属组为mysql
chown -R root:mysql . chown -R mysql:mysql data
19、将mysql的启动服务添加到系统服务中
cp support-files/my-medium.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y
20、创建数据库的表
cd /usr/local/mysql scripts/mysql_install_db --user=mysql
21、设置环境变量
vi /root/.bash_profile #在修改PATH=$PATH:$HOME/bin为: PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib source /root/.bash_profile #使刚才的修改生效
22、手动启动mysql
./bin/mysqld_safe --user=mysql & #启动MySQL,但不能停止 mysqladmin -u root -p shutdown #此时root还没密码,所以为空值,提示输入密码时,直接回车即可。
23、将mysql的启动服务添加到系统服务中
cp support-files/mysql.server /etc/init.d/mysql
24、启动mysql
service mysql start Starting MySQL... ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).
#启动失败,修改权限
chown -R mysql:mysql /usr/local/mysql
#再次启动
/etc/init.d/mysql start
25、修改mysql的root密码及打开远程连接
mysql -u root mysql mysql> use mysql; mysql> desc user; mysql> GRANT ALL PRIVILEGES ON *.* TO [email protected]"%" IDENTIFIED BY "root"; //为root添加远程连接的能力 mysql> update user set Password = password(‘chinaums‘) where User=‘root‘; //设置root用户密码 mysql> select Host,User,Password from user where User=‘root‘; mysql> flush privileges; mysql> exit
26、重新登录
mysql -u root -p
#若还不能进行远程连接,关闭防火墙
27、配置innodb
vi/etc/my.cnf
#添加以下内容
# To take best advantage of current InnoDB features innodb_file_per_table=1 innodb_file_format=barracuda innodb_strict_mode=1
#官方推荐
28、重启Mysql
/usr/local/mysql/support-files/mysql.server stop /etc/init.d/mysql start
时间: 2024-11-05 21:51:55