1.安装JDK
- a.首先下载JDK包 我现在是下载jdk-8u111-linux-x64.rpm这个包,然后通过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
若出现下面提示,说明成功了。
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三个安装包
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及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称)
查询命令:
rpm -qa | grep -i mysql
移除命令:
yum -y remove mysql-libs*
结果显示如下,说明已有安装,需删除
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
若出现
错误:依赖检测失败:
/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
若出现
please install the following Perl modules
则安装
yum install -y perl-Module-Install.noarch
如果在安装MySQL-server-5.6.21-1.rhel5.x86_64.rpm时发生冲突,可能是系统安装了其他版本mysql-lib导致不兼容,
执行以下两个命令
yum list | grep mysql
yum remove mysql-libs
修改配置文件位置
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
- d.初始化MySQL
启动mysql
service mysql start
若出现
[Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
则执行
mysql_install_db --user=mysql
查看初始密码
cat /root/.mysql_secret
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
登录mysql并设置密码
mysql -uroot -pqCT5ZhoNeupT6w1B
SET PASSWORD = PASSWORD('123456');
到这里mysql已经完成安装了,但是远程用户无法访问,接下来
- e.远程登录用户设置
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;
到这里已经可以远程登录MySQL 了,我们用Navicat进行测试,测试结果如下:
QQ20161110-0@2x.png- f.设置开机自启动
chkconfig mysql on
chkconfig --list | grep mysql
- g.MySQL的默认安装位置
/var/lib/mysql/ #数据库目录
/usr/share/mysql #配置文件目录
/usr/bin #相关命令目录
/etc/init.d/mysql #启动脚本
- h.修改字符集和数据存储路径配置 /etc/my.cnf文件,修改数据存放路径、mysql.sock路径以及默认编码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安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写)
lower_case_table_names=1
#(设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384; )
max_connections=1000
[mysql]
default-character-set = utf8
到此MySQL就安装成功了!
3.安装Tomcat
4.安装Nginx
- a.下面开始安装nginx,先获取包
wget http://nginx.org/download/nginx-1.8.0.tar.gz
- b.复制到/usr.local,再解压:
cp nginx-1.8.0.tar.gz /usr/local
cd /usr/local
tar -zxvf nginx-1.8.0.tar.gz
- c.解压完毕,进行安装
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以上,执行以下的
./configure --prefix=/usr/local/nginx \--with-http_ssl_module \--with-http_stub_status_module --with-pcre
若出现以下错误
./configure: error: C compiler cc is not found
安装gcc
yum -y install make gcc gcc-c++ ncurses-devel
若出现
./configure: error: the HTTP rewrite module requires the PCRE library.
则执行
yum -y install pcre-devel
这时安装出现以下错误,说明需要安装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.
执行以下代码:
yum -y install openssl openssl-devel
重新执行
./configure --prefix=/usr/local/nginx \--with-http_ssl_module --with-http_spdy_module \--with-http_stub_status_module --with-pcre
-
d.再执行 make && make install
-
e.启动nginx
nginx -c /usr/local/nginx/conf/nginx.conf
到这里nginx也配置完了~
网友评论