LAMP环境安装
Centos
yum install httpd
systemctl enable httpd #开机启动
systemctl start httpd #启动服务
临时关闭防火墙和selinux
systemctl stop firewalld
setenforce 0
Ubuntu
sudo apt-get update #更新安装源
sudo apt install apache2 #安装apache,配置文件在 /etc/apache2 目录下
apache2ctl -v #查看apache版本
sudo systemctl start apache2 #启动服务
sudo systemctl stop apache2 #关闭服务
sudo apt install libapache2-mod-auth-mysql #安装mysql身份验证模块,其他模块安装方法类似
apache2官方的文档:https://help.ubuntu.com/lts/serverguide/httpd.html
安装Mysql
Centos
vim /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.1/centos7-amd64/
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KplginEY-MariaDB
gpgcheck=1
rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
yum -y install MariaDB-server MariaDB-client
systemctl start mariadb
mysql_secure_installation #配置命令(先退出数据库),设置完root密码,一路回车
mysql -uroot -proot
use mysql;
grant all privileges on *.* to 'root'@'%' identified by 'root'; #授权远程访问
flush privileges;
Ubuntu
sudo apt-get install mariadb-server-10.0 mariadb-client-10.0
sudo service mysql stop #停止mysql服务
sudo mysqld_safe --skip-grant-tables#以安全模式启动mysql,不用密码登录
mysql -uroot
use mysql;
select user,plugin from user; #查看plugin
update user set authentication_string =password('root'),plugin='mysql_native_password' where user='root'; #跟新密码和plgin
grant all privileges on *.* to 'root'@'%' identified by 'root'; #授权远程访问
flush privileges;
sudo service mysql start
mysql -uroot -proot
安装PHP
Centos
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
yum makecache
yum -y install php70w* --skip-broken
service httpd restart
php -v
Ubuntu
sudo apt install php7.0-mysql php7.0-mysqli php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0
蓬莱文章建安骨,中间小谢又清发

浙公网安备 33010602011771号