1.JDK安装
1. 查看当前Linux系统是否已经安装java
rpm -qa | grep -i java
rpm -e --nodeps xxxxxx
2. 解压已上传的JDK压缩包,并移动到/usr/local目录下
tar -zxvf /root/jdk-8u201-linux-x64.tar.gz -C/usr/local/
3. 测试jdk
/usr/local/jdk1.8.0_201/bin/java -version
4. 配置环境变量
vim /etc/profile
G 跳转到最后一行
i 进入插入模式
export JAVA_HOME=/usr/local/jdk1.8.0_201
export PATH=$PATH:$JAVA_HOME/bin
esc 进入命令行模式
:wq! 保存
5. 更新环境变量
source /etc/profile
6. 测试
java -version
2.Tomcat安装
1. 解压已上传的Tomcat压缩包,到/user/local目录下
tar -zxvf /root/apache-tomcat-8.5.27.tar.gz -C /root
cp -r /root/apache-tomcat-8.5.27 /usr/local/tomcat1
2. 启动tomcat
/usr/local/tomcat1/bin/startup.sh
3. 动态查看日志
tail -f /usr/local/tomcat1/logs/catalina.out
4. 防火墙放行端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
5. 关闭tomcat
/usr/local/tomcat1/bin/shutdown.sh
3.MySQL安装
1. 查看CentOS是否自带的MySQL环境
rpm -qa | grep -i mysql
rpm -qa | grep -i mariadb
2. 卸载mariadb
rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
3. 解压文件
mkdir -p /usr/local/mysql
tar -zxvf /root/mysql-5.7.25-1.el7.x86_64.rpm-bundle.tar.gz -C/usr/local/mysql
cd /usr/local/mysql/
4. 安装libaio环境(已经存在不需要)
yum install libaio
5. 安装MySQL(按顺序)
rpm -ivh /usr/local/mysql/mysql-community-common-5.7.25-1.el7.x86_64.rpm
rpm -ivh /usr/local/mysql/mysql-community-libs-5.7.25-1.el7.x86_64.rpm
rpm -ivh /usr/local/mysql/mysql-community-devel-5.7.25-1.el7.x86_64.rpm
rpm -ivh /usr/local/mysql/mysql-community-libs-compat-5.7.25-1.el7.x86_64.rpm
rpm -ivh /usr/local/mysql/mysql-community-client-5.7.25-1.el7.x86_64.rpm
rpm -ivh /usr/local/mysql/mysql-community-server-5.7.25-1.el7.x86_64.rpm
6. 启动mysql服务
systemctl start mysqld
7. 查看随机生成的密码
grep 'temporary password' /var/log/mysqld.log
8. 修改root用户密码
mysql -u root -p
Enter password:输入刚才查询到的随机密码
>set global validate_password_length=4;
>set global validate_password_policy=LOW;
>set password = password('root');
9. 防火墙放行端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
10. 开启mysql的远程登录权限
mysql -uroot -proot
> CREATE USER 'root'@'%' IDENTIFIED BY 'root';
> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' ;
> FLUSH PRIVILEGES;
> exit;
11. MySQL编码问题(默认安装完毕为 ISO-8859-1)
1. 编辑/etc/my.cnf,在[mysqld]选项下添加字符集的设置
vim /etc/my.cnf
[mysqld]
character-set-server=utf8
2. 重新启动mysql的服务
systemctl restart mysqld```
# 4.Nginx安装
```java
1. 安装必须库
yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel -y
2. 解压文件
tar -zxvf /root/nginx-1.13.9.tar.gz -C /root
3. 配置
cd /root/nginx-1.13.9
./configure --prefix=/usr/local/nginx
4. 编译
make
5. 安装
make install
6. 启动
/usr/local/nginx/sbin/nginx
7. 防火墙放行端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
8. 停止nginx
/usr/local/nginx/sbin/nginx -s stop #停止服务
9. 修改后,执行
/usr/local/nginx/sbin/nginx -s reload #重新加载配置
5.Redis安装
1. 解压文件
tar -zxvf /root/redis-3.0.7.tar.gz -C /root
2. 编译
cd /root/redis-3.0.7
make
3. 安装
make PREFIX=/usr/local/redis install
4. 复制配置文件到/usr/local/redis/bin
cp /root/redis-3.0.7/redis.conf /usr/local/redis/bin/
5. 设置后台启动
vim /usr/local/redis/bin/redis.conf
daemonize yes
6. 启动redis
/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
7. 防火墙放行端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent
firewall-cmd --reload
8. 关闭redis
/usr/local/redis/bin/redis-cli shutdown
|