您好,登錄后才能下訂單哦!
這篇文章主要介紹了Fedora 23如何安裝LAMP服務器,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
LAMP其實就是Linux+Apache+PHP+MySQL環境,
Apache 是一款開源的 web 服務框架。完全支持 CGI, SSL。
切換到 root 賬戶: su Fedora 23/22 輸入以下命令來安裝Apache: dnf install httpd -y Fedora 21 及更早的版本: yum install httpd -y 啟動httpd服務,以在每次系統啟動服務: systemctl enable httpd 使用以下命令來啟動httpd服務: systemctl start httpd
如果您遇到以下錯誤:
Job for httpd.service failed. See ‘systemctl status httpd.service’ and ‘journalctl -xn’ for details.
刪除所有內容在/etc/hostname,并加上“localhost”。同時,在/etc/httpd/conf/httpd.conf文件中的“Servername”的值設定為“localhost”,并再次嘗試啟動httpd服務。
并調整防火墻以允許httpd服務,從遠程客戶端訪問。
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https
重新啟動firewalld服務:
firewall-cmd --reload
打開瀏覽器,輸入服務器IP訪問:
Fedora 23/22 用戶安裝命令:
dnf install mariadb mariadb-server -y
Fedora 21 及早前版本命令:
yum install mariadb mariadb-server -y
隨系統自動啟動命令:
systemctl enable mariadb
啟動數據庫服務器:
systemctl start mariadb
設置 MariaDB root 賬戶密碼,默認情況下MySQL root用戶的密碼為空。因此,以防止未經授權的訪問MySQL數據庫,我們設置需要root用戶密碼:
mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer ‘n’.
Change the root password? [Y/n] y ## Enter ‘y’ and press enter ##
New password: ## Enter password ##
Re-enter new password: ## Re-enter password ##
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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? [Y/n] ## Press Enter ##
… Success!
Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] ## Press Enter ##
… Success!
By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] ## Press Enter ##
– Dropping test database…
ERROR 1008 (HY000) at line 1: Can’t drop database ‘test’; database doesn’t exist
… Failed! Not critical, keep moving…
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] ## Press Enter ##
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Fedora 23/22 用戶命令:
dnf install php -y
Fedora 21 及早期版本:
yum install php -y
測試PHP是否運行:
vi /var/www/html/testphp.php
輸入以下內容:
重啟 Http 服務:
systemctl restart httpd
瀏覽器輸入看看:
搜索模塊并安裝:
Fedora 23/22 用戶:
dnf search php
Fedora 22及早期版本:
yum search php
現在安裝你所選擇所需模塊,例如php-mysql,使用以下命令:
Fedora 23/22 用戶:
dnf install php-mysql -y
Fedora 22及早期版本:
yum install php-mysql -y
重啟 HTTP 服務:
systemctl restart httpd
瀏覽器查看模塊安裝是否成功:
phpmyadmin 用于管理數據庫:
Fedora 23/22 用戶:
dnf install phpmyadmin -y
Fedora 22及早期版本:
yum install phpmyadmin -y
缺省情況下,phpMyAdmin 只能從本地主機進行訪問。若要從遠程系統訪問您的網絡中,請執行下列操作步驟。
vi /etc/httpd/conf.d/phpMyAdmin.conf
查找并注釋掉127.0.0.1 和請求 ip ::1 lines。然后添加一個額外的行要求所有授予略低于為注釋行。
這是我的更改后的 phpMyAdmin.conf 文件。這些變化以粗體標記。
[...] Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin AddDefaultCharset UTF-8 # Apache 2.4 # Require ip 127.0.0.1# Require ip ::1 Require all granted # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 # Apache 2.4 # Require ip 127.0.0.1# Require ip ::1 Require all granted [...]
重要提示:不過讓localhost以外的人訪問數據庫,應視為危險,除非通過SSL適當保護。做到這一點需要您自擔風險。
保存并關閉文件。重新啟動httpd服務。
systemctl restart httpd
OK,打開 phpmyadmin 測試一下:
好了,安裝完畢!
感謝你能夠認真閱讀完這篇文章,希望小編分享的“Fedora 23如何安裝LAMP服務器”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。