一、安装Java
1、切换到安装包目录 cd /opt/linux
2、解压 tar -zxvf jdk-8u202-linux-x64.tar.gz
3、复制文件到usr 目录 mv jdk1.8.0_202 /usr/local
4、修改配置文件 vi /etc/profile
5、写入以下内容
export JAVA_HOME=/usr/local/jdk1.8.0_202
export JRE_HOME=/usr/local/jdk1.8.0_202/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
6、source /etc/profile
7、检查Java版本 java -version 编辑 javac
1.后台启动,daemonize yes
2.绑定端口,port 6379 默认是6379 需要安全组开放端口
3.绑定IP,bind 192.168.1.101
4.指定数据存放路径,dir /usr/local/redis/log rdb存放的路径
5.指定持久化方式,appendonly yes
6.requirepass tj123456 设置密码
9、启动 ./bin/redis-server ./redis.conf
10、设置开机自启动
cp /opt/linux/redis-5.0.7/utils/redis_init_script /etc/init.d/redis
11、编辑文件
vim /etc/init.d/redis
chmod +x redis
chkconfig redis on
三、安装mysql
1、创建mysql用户
groupadd mysql
useradd -r -g mysql mysql
xz -d mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz
tar -xvf mysql-8.0.18-linux-glibc2.12-x86_64.tar
chown -R mysql:mysql /usr/local/mysql
chmod -R 755 /usr/local/mysql
cd /usr/local/mysql/bin
./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql --lower-case-table-names=1
datadir=/usr/local/mysql/data
port = 3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
symbolic-links=0
max_connections=400
innodb_file_per_table=1
#表名大小写不明感,敏感为
lower_case_table_names=1
注释掉socket=/var/lib/mysql/mysql.sock #socket=/var/lib/mysql/mysql.sock
mkdir /var/log/mariadb
touch /var/log/mariadb/mariadb.log
chown -R mysql:mysql /var/log/mariadb
vi /etc/selinux/config
修改 SELINUX=disabled
重启服务器
/usr/local/mysql/support-files/mysql.server start
ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
mysql -u root -p
mysql>set password for root@localhost ='tj123456';
mysql>use mysql;
mysql>update user set user.Host='%' where user.User='root';
mysql> flush privileges;
确保navicat可以连接
mysql>ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'tj123456';
mysql> flush privileges;
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
四、安装nginx
1.切换到安装包目录 cd /opt/linux
2.解压 tar -zxvf nginx-1.8.0.tar.gz
3.切换目录 cd nginx-1.8.0/
4.编译安装 ./configure make && make install 默认安装到 /usr/local/nginx
5.切换目录 cd /usr/local/nginx/
6.启动 ./sbin/nginx
7.Ip 访问测试 10.76.11.130:80
8.修改配置文件 cd /usr/local/nginx/conf/ vi nginx.conf
9.配置后端服务组
upstream test.com{
server 10.76.11.130:8080 weight=1;
server 10.76.11.134:8080 weight=2;
}
10.使用服务组
location /test/ {
proxy_pass http://test.com/;
proxy_redirect default;
}
11.重启nginx ./sbin/nginx -s reload