Centos7下jdk、mysql、iptables、nginx、redis安装简介
一.JDK
# jdk
yum search java | grep -i --color JDK
yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel
cd /usr/lib/jvm/
cd java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/
# 配置环境变量
vim /etc/profile
# 在文件最后面添加如下三行内容(具体路径根据自己的实际情况确定)
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
# 使配置文件即时生效
source /etc/profile
# 检查jdk是否安装按成
java -version
二.MySQL
# mysql
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum repolist enabled | grep "mysql.*"
yum -y install mysql-community-server
# 常用操作命令
systemctl enable mysqld
systemctl start mysqld
systemctl status mysqld.service
三.iptables
# iptables
# 停止firewalld
systemctl stop firewalld
# 屏蔽firewalld
systemctl mask firewalld
yum install iptables-services
# 启用iptables
systemctl enable iptables
systemctl start iptables
service iptables save
# 配置iptables规则
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
# 重启iptables
systemctl restart iptables
四.Nginx
# nginx
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum info nginx
yum install nginx
五.Redis
# redis
yum install epel-release && yum install redis
cp /etc/redis.conf /etc/redis.conf.back
# 配置redis密码(强烈建议)
vim /etc/redis.conf
# 在配置文件中找到requirepass,将前面的#号注释放开,后面填上自己的redis密码,保存文件,重启redis即可
requirepass password
service redis start
- 本文标签: Java MySQL Nginx
- 本文链接: https://zhyd.me/article/98
- 版权声明: 本文由张亚东原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权