LAMP+redis安装部署

1、安装版本说明 php7.2+apache2.4+mysql5.7+redis

yum源:php升级

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

常用命令:yum list php* yum list installed | grep php* php --versi

2、安装php及扩展包

yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml  php-redis

php版本:PHP 7.2.27 (cli) (built: Jan 26 2020 15:49:49) ( NTS ) Copyright
© 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright ©
1998-2018 Zend Technologies
with Zend OPcache v7.2.27, Copyright © 1999-2018, by Zend Technologies

3、安装apache

yum -y install httpd
systemctl start httpd
lsof -i:80
systemctl enable httpd
httpd -v

Server version: Apache/2.4.6 (CentOS) Server built: Apr 2 2020
13:13:23

4、安装mariadb(备选)

yum -y install mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb
lsof -i:3306
mysql_secure_installation 
mysql -uroot -p
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
update user set password=password("123456") where user="root";
flush privileges;

5、安装mysql5.7

默认直接下载的是mysql5.5,需要更新mysql源。

1、下载mysql源安装包
 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
2、安装mysql源
 yum localinstall mysql57-community-release-el7-8.noarch.rpm -y
3、以上完成后,接下来就是检测源是否安装成功
 yum repolist enabled | grep "mysql.*-community.*"  

备注:可以通过 vim /etc/yum.repos.d/mysql-community.repo
修改这个配置用来yum的时候安装mysql的版本。5.7的enabled=1,其他度为0,就安装的是5.7的版本。

4、下载安装mysql数据库
yum -y install mysql-community-server    
systemctl start mysqld
systemctl status mysqld 
systemctl enable mysqld
systemctl daemon-reload               //重载服务
5、mysql5.7安装时会产生一个默认的密码,查看此密码的文件一般存在于/var/log/mysqld.log上
	grep 'temporary password' /var/log/mysqld.log         //查看密码

实际操作中未发现密码,更改vim /etc/my.cnf,添加skip-grant-tables 重启数据库,mysql登录。

6、更改数据库登陆密码
use mysql;
update user set authentication_string=password("123456") where user="root";
flush privileges;
7、升级数据结构,授权远程登陆。
mysql_upgrade -uroot -p123456     
mysql -uroot -p123456
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
flush privileges;
vim /etc/my.cnf
#skip-grant-tables

6、安装redis

yum -y install redis
systemctl start redis
systemctl status redis
systemctl enable redis
ps -ef | grep redis
vim /etc/redis.conf   (开启远程,设置密码)
 61 #bind 127.0.0.1
 80 protected-mode no
 481 requirepass 654321     redis密码
ps -ef | grep redis
kill -9 PID
systemctl restart redis
进入redis: redis-cli -h 127.0.0.1 -p 6379
输入用户名、密码:auth  654321     info看信息
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值