日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

CentOS7 配置LAMP環(huán)境

 印度阿三17 2020-12-11

一、關(guān)閉防火墻

1.查看防火墻狀態(tài)

systemctl status firewalld

  • inactive 關(guān)閉狀態(tài)
  • active? 開啟狀態(tài)

2.關(guān)閉防火墻

systemctl stop firewalld

3.永久關(guān)閉防火墻

systemctl disable firewalld

二、安裝Apache

1.安裝Apache服務(wù)及擴(kuò)展包

yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql

2.啟動(dòng)Apache服務(wù)

systemctl start httpd

3.設(shè)置Apache服務(wù)開機(jī)自啟動(dòng)

systemctl enable httpd

4.查看apache是否安裝成功

在瀏覽器地址欄輸入 http://ip地址,運(yùn)行,出現(xiàn)如下頁面即安裝成功

?

?

三、安裝并配置MySQL

? 1.更新YUM源

rpm -Uvh  http://dev./get/mysql57-community-release-el7-9.noarch.rpm

 2.安裝MySQL

yum -y install mysql-community-server

  如果出現(xiàn)”No match for argument“錯(cuò)誤,請先運(yùn)行yum module disable mysql禁用默認(rèn)的mysql模塊,再安裝MySQL

 3.查看MySQL版本號(hào)

mysql -V

 出現(xiàn)如下信息即表示安裝成功,注意”V“要大寫

?

?

 ?4.啟動(dòng)mysql

systemctl start mysqld

 5.設(shè)置開機(jī)自啟動(dòng)

systemctl enable mysqld
systemctl daemon-reload

 6.查看初始密碼

grep "password" /var/log/mysqld.log

  

 7.配置MySQL的安全性

mysql_secure_installation
  • 重置root賬號(hào)的密碼
Enter password for user root: #輸入上一步獲取的root用戶初始密碼
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration of the plugin.
Using existing password for root.
Estimated strength of the password: 100 
Change the password for root ? (Press y|Y for Yes, any other key for No) : Y #是否更改root用戶密碼,輸入Y
New password: #輸入新密碼,長度為8至30個(gè)字符,必須同時(shí)包含大小寫英文字母、數(shù)字和特殊符號(hào)。特殊符號(hào)可以是()` ~!@#$%^&*- =|{}[]:;‘<>,.?/
Re-enter new password: #再次輸入新密碼
Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y
  • 輸入Y刪除匿名用戶賬號(hào)
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y  #是否刪除匿名用戶,輸入Y
Success.
  • 輸入Y禁止root賬號(hào)遠(yuǎn)程登錄
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y #禁止root遠(yuǎn)程登錄,輸入Y
Success.
  • 輸入Y刪除test庫以及對test庫的訪問權(quán)限
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y #是否刪除test庫和對它的訪問權(quán)限,輸入Y
- Dropping test database...
Success.
  • 輸入Y重新加載授權(quán)表
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y #是否重新加載授權(quán)表,輸入Y
Success.
All done!

四、安裝PHP

 1.更新YUM源

  • 添加epel源
yum install -y https://repo./ius-release-el7.rpm https://dl./pub/epel/epel-release-latest-7.noarch.rpm
  • 添加Webtatic源
rpm -Uvh https://mirror./yum/el7/webtatic-release.rpm

  2.安裝PHP

yum -y install php70w-devel php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64  php70w-pdo.x86_64   php70w-mysqlnd  php70w-fpm php70w-opcache php70w-pecl-redis php70w-pecl-mongodb

  3.查看PHP版本

php -v

  出現(xiàn)如下結(jié)果即表示php安裝成功

 4.在Apache網(wǎng)站根目錄創(chuàng)建測試文件

echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php

 5.重啟Apache服務(wù)

systemctl restart httpd

 6.運(yùn)行。在瀏覽器地址欄輸入http://ip地址/phpinfo.php,出現(xiàn)如下頁面即表示安裝成功

?

?

?五、安裝phpMyAdmin

 1.創(chuàng)建phpMyAdmin數(shù)據(jù)存放目錄

mkdir -p /var/www/html/phpmyadmin

 2.下載phpMyAdmin壓縮包并解壓

  • 下載
wget https://files./phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.zip
  • 解壓
yum install -y unzip
unzip phpMyAdmin-4.0.10.20-all-languages.zip

 3.復(fù)制phpMyAdmin文件到準(zhǔn)備好的數(shù)據(jù)存放目錄

mv phpMyAdmin-4.0.10.20-all-languages/*  /var/www/html/phpmyadmin

 4.檢查是否安裝成功。在瀏覽器地址欄輸入http://ip地址/phpmyadmin,運(yùn)行,出現(xiàn)如下頁面即表示安裝成功

 

?

LAMP環(huán)境配置完成!

如果使用navicat連接數(shù)據(jù)庫報(bào)錯(cuò),ERROR 1130: Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server,是無法給遠(yuǎn)程連接的用戶權(quán)限問題,就是”7.配置MySQL的安全性“中第三步設(shè)置了禁止遠(yuǎn)程登陸

解決辦法:

mysql -u root -p密碼

  進(jìn)入Mysql控制臺(tái)

  • 提權(quán)
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密碼' WITH GRANT OPTION; 
  • 刷新
flush privileges;
來源:https://www./content-3-781951.html

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請遵守用戶 評(píng)論公約

    類似文章 更多