Linux安装Java、MySQL、redis等

安装Java的jdk

yum list java-1.8*    查看可以安装的版本
yum install java-1.8.0-openjdk.x86_64 -y   

安装tomcat

wget -i-c https://mirrors.bfsu.edu.cn/apache/tomcat/tomcat-8/v8.5.64/bin/apache-tomcat-8.5.64.tar.gz  下载tomcat
tar -zxf apache-tomcat-8.5.64.tar.gz		解压
mv apache-tomcat-8.5.64 tomcat			改名

安装redis

yum install redis -y	  
启动:systemctl start redis
关闭:systemctl stop redis
重启:systemctl restart redis

安装MySQL

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm   下载安装使用的yum
yum -y install mysql57-community-release-el7-10.noarch.rpm		下载MySQL
yum -y install mysql-community-server		安装MySQL
systemctl start  mysqld.service		启动MySQL
systemctl status mysqld.service		查看MySQL启动状态
grep "password" /var/log/mysqld.log	查看默认密码
mysql -uroot -p		进入数据库
set global validate_password_policy=0;	修改密码校验
set global validate_password_length=1;	修改密码校验
alter user 'root'@'localhost' identified by '123456';	修改密码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码';	开启远程访问权限
exit 		退出数据库
yum -y remove mysql57-community-release-el7-10.noarch	卸载掉安装MySQL使用的yum软件,否则每次yum操作都会自动更新

安装nginx

yum install yum-utils		准备工作
cd /etc/yum.repos.d/	进入目录
vim nginx.repo		创建文件
复制下方文字到新创建的文件中
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key

yum search nginx		查看是否添加源成功
yum install nginx		安装
rpm -qa | grep nginx		查看
systemctl start nginx		启动nginx
systemctl enable nginx	加入开机自启动
systemctl status nginx	查看nginx状态
vim /etc/nginx/conf.d/default.conf	查看配置文件
默认端口为80,默认项目部署路径为: /usr/share/nginx/html/

你可能感兴趣的:(工具类,linux)