LAMP CentOS7 開發環境配置
阿新 • • 發佈:2022-04-29
本文簡要介紹了手動搭建 LNMP 開發環境的步驟。
MySQL
mysql-community-client-5.7.13-1.el7.x86_64.rpm
mysql-community-common-5.7.13-1.el7.x86_64.rpm
mysql-community-libs-5.7.13-1.el7.x86_64.rpm
mysql-community-server-5.7.13-1.el7.x86_64.rpm
$ rpm -qa | grep mariadb $ rpm -e --nodeps mariadb-libs-5.5.37-1.el7_0.x86_64 $ yum install *.rpm $ service mysqld start $ service mysqld status
找到初始密碼
$ sudo grep 'temporary password' /var/log/mysqld.log
$ mysql -uroot -p
$ ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
新增遠端登入使用者
$ GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED BY 'mytest' WITH GRANT OPTION;
MySQL 5.5
編輯 /etc/mysql/my.conf
檔案。
[mysqld] bind-address=127.0.0.1 改為 bind-address=0.0.0.0
PHP
PHP 5
$ yum install php56u-fpm
PHP 7
$ rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
$ yum install php70w-fpm
$ yum install php70w-mysqlnd # PHP與資料庫連線
啟動服務
# 開啟 PHP-FPM 服務
$ systemctl start php-fpm.service
# 開機自啟動
$ systemctl enable php-fpm.service