CentOS7.3安装LAMP(Centos7.3+Apache2.4.6+mysql5.6.38+php5.4.16)

CentOS7.3安装LAMP(Centos7.3+Apache2.4.6+mysql5.6.38+php5.4.16)
---------------------------------------------------------------------




检查Apache是否已经安装
[root@localhost ~]# httpd -v

查看Apache包是否可用
[root@localhost ~]# yum list | grep httpd

使用yum安装Apache,并且安装扩展模块
[root@localhost ~]# yum -y install httpd httpd-manual httpd-devel mod_ssl mod_perl mod_auth_mysql

设置开机自动启动Apache服务
[root@localhost ~]# systemctl enable httpd.service

启动Apache服务
[root@localhost ~]# systemctl start httpd.service

重新Apache服务
[root@localhost ~]# systemctl restart httpd.service

查看服务状态
[root@localhost ~]# systemctl status httpd.service

判断是否安装成功Apache服务
[root@localhost ~]# curl http://127.0.0.1

将原有配置文件备份
[root@localhost ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak

----------------------------------------------------------------------

检查mysql是否已经安装
[root@localhost ~]# yum list installed | grep mysql

查看mysql包是否可用
[root@localhost ~]# yum list | grep mysql

下载MySql安装包,确认yum源的链接是不是有效的
[root@localhost ~]# rpm -ivh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

安装MySql服务器端
[root@localhost ~]# yum install -y mysql-community-server

安装MySql客户端
[root@localhost ~]# yum -y install mysql-server mysql mysql-devel

设置开机启动Mysql
[root@localhost ~]# systemctl enable mysqld.service

设置开启服务
[root@localhost ~]# systemctl start mysqld.service

重新Apache服务
[root@localhost ~]# systemctl restart mysqld.service

查看服务状态
[root@localhost ~]# systemctl status mysqld.service

登陆MySql,输入用户名和密码
[root@localhost ~]# mysql -uroot -p

修改当前用户密码
mysql>SET PASSWORD = PASSWORD('Abc123!_');

开启远程登录,授权root远程登录,开放3306端口
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Abc123!_' WITH GRANT OPTION;

命令立即执行生效
mysql>flush privileges;

退出mysql
mysql>exit;

将原有配置文件备份
[root@localhost ~]# cp /etc/my.cnf /etc/my.cnf.bak

----------------------------------------------------------------------

检查php是否已经安装
[root@localhost ~]# php -v

查看php包是否可用
[root@localhost ~]# yum list | grep php

使用yum安装php,并且安装扩展模块
[root@localhost ~]# yum -y install php php-odbc php-mysql php-devel php-xml php-gd php-imap php-ldap php-xmlrpc php-common php-process php-bcmath php-cli php-fpm php-pear php-pdo php-pecl-xhprof php-pecl-xdebug php-phpunit-PHPUnit php-mbstring php-mcrypt php-pecl-apcu php-opcache

----------------------------------------------------------------------

检查vsftpd是否已经安装
[root@localhost ~]# vsftpd -v

查看vsftpd包是否可用
[root@localhost ~]# yum list | grep vsftpd

安装默认的vsftpd
[root@localhost ~]# yum -y install vsftpd

设置服务开机自启
[root@localhost ~]# systemctl enable vsftpd.service

设置开启服务
[root@localhost ~]# systemctl start vsftpd.service

重新开启服务
[root@localhost ~]# systemctl restart vsftpd.service

查看服务状态
[root@localhost ~]# systemctl status vsftpd.service

将原有配置文件备份
[root@localhost ~]# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak


----------------------------------------------------------------------

确保服务器系统处于最新状态
[root@localhost ~]# yum -y upgrade

重启服务器
[root@localhost ~]# reboot




----------------------------------------------------------------------


yum -y update

升级所有包,改变软件设置和系统设置,系统版本内核都升级

yum -y upgrade

升级所有包,不改变软件设置和系统设置,系统版本升级,内核不改变
上一篇:php动态编译openssl过程


下一篇:for循环、while循环、break跳出循环、continue结束本次循环、exit退出整个脚本