1.安裝JDK
- a.首先下載JDK包 我現(xiàn)在是下載jdk-8u111-linux-x64.rpm這個(gè)包,然后通過(guò)scp命令上傳上去,下載地址如下:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
scp -r /Users/paul/Desktop/jdk-8u111-linux-x64.rpm root@[your ip]:/home
- b.直接輸入命令安裝指令
rpm -ivh jdk-8u111-linux-x64.rpm
安裝完成輸入
java -version
若出現(xiàn)下面提示赦抖,說(shuō)明成功了舱卡。
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
2.安裝MySQL
- a.首先下載mysql三個(gè)安裝包
wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm
wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm
wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm
- b.檢查MySQL及相關(guān)RPM包,是否安裝队萤,如果有安裝轮锥,則移除(rpm –e 名稱(chēng))
查詢(xún)命令:
rpm -qa | grep -i mysql
移除命令:
yum -y remove mysql-libs*
結(jié)果顯示如下,說(shuō)明已有安裝要尔,需刪除
mysql-libs-5.1.73-3.el6_5.x86_64
- c.安裝MySQL
rpm -ivh MySQL-server-5.6.21-1.rhel5.x86_64.rpm
rpm -ivh MySQL-devel-5.6.21-1.rhel5.x86_64.rpm
rpm -ivh MySQL-client-5.6.15-1.el6.x86_64.rpm
若出現(xiàn)
錯(cuò)誤:依賴(lài)檢測(cè)失斏岫拧:
/usr/bin/perl 被 MySQL-server-5.6.21-1.rhel5.x86_64 需要
libaio.so.1()(64bit) 被 MySQL-server-5.6.21-1.rhel5.x86_64 需要
libaio.so.1(LIBAIO_0.1)(64bit) 被 MySQL-server-5.6.21-1.rhel5.x86_64 需要
libaio.so.1(LIBAIO_0.4)(64bit) 被 MySQL-server-5.6.21-1.rhel5.x86_64 需要
則安裝
yum install perl
yum install libaio
若出現(xiàn)
please install the following Perl modules
則安裝
yum install -y perl-Module-Install.noarch
如果在安裝MySQL-server-5.6.21-1.rhel5.x86_64.rpm時(shí)發(fā)生沖突新娜,可能是系統(tǒng)安裝了其他版本mysql-lib導(dǎo)致不兼容,
執(zhí)行以下兩個(gè)命令
yum list | grep mysql
yum remove mysql-libs
修改配置文件位置
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
- d.初始化MySQL
啟動(dòng)mysql
service mysql start
若出現(xiàn)
[Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
則執(zhí)行
mysql_install_db --user=mysql
查看初始密碼
cat /root/.mysql_secret
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
登錄mysql并設(shè)置密碼
mysql -uroot -pqCT5ZhoNeupT6w1B
SET PASSWORD = PASSWORD('123456');
到這里mysql已經(jīng)完成安裝了,但是遠(yuǎn)程用戶(hù)無(wú)法訪問(wèn)既绩,接下來(lái)
- e.遠(yuǎn)程登錄用戶(hù)設(shè)置
show databases;
use mysql;
select host,user,password from user;
update user set password=password('123456') where user='root';
update user set host='%' where user='root' and host='localhost';
flush privileges;
到這里已經(jīng)可以遠(yuǎn)程登錄MySQL 了概龄,我們用Navicat進(jìn)行測(cè)試,測(cè)試結(jié)果如下:
- f.設(shè)置開(kāi)機(jī)自啟動(dòng)
chkconfig mysql on
chkconfig --list | grep mysql
- g.MySQL的默認(rèn)安裝位置
/var/lib/mysql/ #數(shù)據(jù)庫(kù)目錄
/usr/share/mysql #配置文件目錄
/usr/bin #相關(guān)命令目錄
/etc/init.d/mysql #啟動(dòng)腳本
- h.修改字符集和數(shù)據(jù)存儲(chǔ)路徑配置 /etc/my.cnf文件熬词,修改數(shù)據(jù)存放路徑旁钧、mysql.sock路徑以及默認(rèn)編碼utf-8
[client]
password = 123456
port = 3306
default-character-set=utf8
[mysqld]
port = 3306
character_set_server=utf8
character_set_client=utf8
collation-server=utf8_general_ci
#(注意linux下mysql安裝完后是默認(rèn):表名區(qū)分大小寫(xiě),列名不區(qū)分大小寫(xiě)互拾; 0:區(qū)分大小寫(xiě),1:不區(qū)分大小寫(xiě))
lower_case_table_names=1
#(設(shè)置最大連接數(shù)嚎幸,默認(rèn)為 151颜矿,MySQL服務(wù)器允許的最大連接數(shù)16384; )
max_connections=1000
[mysql]
default-character-set = utf8
到此MySQL就安裝成功了!
3.安裝Tomcat
4.安裝Nginx
- a.下面開(kāi)始安裝nginx嫉晶,先獲取包
wget http://nginx.org/download/nginx-1.8.0.tar.gz
- b.復(fù)制到/usr.local骑疆,再解壓:
cp nginx-1.8.0.tar.gz /usr/local
cd /usr/local
tar -zxvf nginx-1.8.0.tar.gz
- c.解壓完畢,進(jìn)行安裝
cd nginx-1.8.0
./configure --prefix=/usr/local/nginx \--with-http_ssl_module --with-http_spdy_module \--with-http_stub_status_module --with-pcre
如果是1.9.5以上替废,執(zhí)行以下的
./configure --prefix=/usr/local/nginx \--with-http_ssl_module \--with-http_stub_status_module --with-pcre
若出現(xiàn)以下錯(cuò)誤
./configure: error: C compiler cc is not found
安裝gcc
yum -y install make gcc gcc-c++ ncurses-devel
若出現(xiàn)
./configure: error: the HTTP rewrite module requires the PCRE library.
則執(zhí)行
yum -y install pcre-devel
這時(shí)安裝出現(xiàn)以下錯(cuò)誤箍铭,說(shuō)明需要安裝OpenSSL
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
執(zhí)行以下代碼:
yum -y install openssl openssl-devel
重新執(zhí)行
./configure --prefix=/usr/local/nginx \--with-http_ssl_module --with-http_spdy_module \--with-http_stub_status_module --with-pcre
d.再執(zhí)行 make && make install
e.啟動(dòng)nginx
nginx -c /usr/local/nginx/conf/nginx.conf
到這里nginx也配置完了~