centos安装lamp

Yum install net-tools

安装ssh

yum install -y openssl openssh-server
systemctl start sshd.service

设置开机自动启动ssh服务

systemctl enable sshd.service
ssh –p 22 root@x.x.x.x  

关闭firewall:

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

1.安装Apache

yum install httpd

2.设置服务器开机自动启动Apache

systemctl enable httpd.service

1.若之前安装过其他版本PHP,先删除

 yum remove php*

2.rpm安装PHP7相应的yum源
CentOS/RHEL 7.x:

 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
3.yum安装PHP7

 yum install php70w

4.安装其他插件(选装)
这一步如果闲麻烦的话直接在上一步执行下面这条命令即可(提示有冲突的话按照提示过滤冲突即可)
yum install php70w* //意为安装全部插件
php70w
php70w-opcache
php70w-bcmath
php70w-cli
php70w-common
php70w-dba
php70w-devel
php70w-embedded
php70w-enchant
php70w-fpm
php70w-gd
php70w-imap
php70w-interbase
php70w-intl
php70w-ldap
php70w-mbstring
php70w-mcrypt
php70w-mysql
php70w-mysqlnd
php70w-odbc
php70w-opcache
php70w-pdo
php70w-pdo_dblib
php70w-pear
php70w-pecl-apcu
php70w-pecl-imagick
php70w-pecl-xdebug
php70w-pgsql
php70w-phpdbg
php70w-process
php70w-pspell
php70w-recode
php70w-snmp
php70w-soap
php70w-tidy
php70w-xml
php70w-xmlrpc
5. 安装完毕,测试是否安装成功

 php -v

6.要运行PHP网页,要启动php-fpm解释器

 service php-fpm start

Mysql:
下载mysql的yum源
进入用户目录,创建mysql文件夹

mkdir mysql 

使用wget下载 yum 源安装包

wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 

安装yum源

rpm -ivh mysql57-community-release-el7-8.noarch.rpm 

安装完成得到如下两个文件
mysql-community.repo
mysql-community-source.repo
安装mysql
执行mysql安装命令

yum -y install mysql-server 

安装完成后,启动mysql服务器

service mysqld start 

重置mysql 的密码
步骤如下:

1.修改 /etc/my.cnf配置文件,在 [mysqld]下添加一行:skip-grant-tables=1 
这一行配置让 mysqld 启动时不对密码进行验证
2.重启 mysqld 服务:systemctl restart mysqld
3.使用 root 用户登录到 mysql:mysql -u root
4.切换到mysql数据库(use mysql),更新 user 表: 
update user set authentication_string=passworD("test") where user='root';
5、退出 mysql,编辑 /etc/my.cnf 配置文件,删除 skip-grant-tables=1 这一行
6、systemctl restart mysqld 重启mysqld服务,再用新密码登录即可
出现
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
set global validate_password_policy=0;
set global validate_password_length=1;
SET PASSWORD = PASSWORD('123456'); 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值