您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關(guān)Fedora 23怎么安裝LAMP服務(wù)器,小編覺得挺實用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
lamp就是Web應(yīng)用軟件組合,是由 Linux、 Apache HTTP 服務(wù)、 MySQL/MariaDB 數(shù)據(jù)庫和 PHP、 Perl 或 Python 的簡稱。
下面教你如何在 Fedora 23 服務(wù)器上安裝 LAMP 組合。
下面的教程默認使用 192.168.1.102/24 實例,請按照你的服務(wù)器做修改。
安裝 Apache
Apache 是一款開源的 web 服務(wù)框架。完全支持 CGI, SSL。
切換到 root 賬戶: su Fedora 23/22 輸入以下命令來安裝Apache: dnf install httpd -y Fedora 21 及更早的版本: yum install httpd -y 啟動httpd服務(wù),以在每次系統(tǒng)啟動服務(wù): systemctl enable httpd 使用以下命令來啟動httpd服務(wù): systemctl start httpd
如果您遇到以下錯誤:
Job for httpd.service failed. See ‘systemctl status httpd.service’ and ‘journalctl -xn’ for details.
刪除所有內(nèi)容在/etc/hostname,并加上“l(fā)ocalhost”。同時,在/etc/httpd/conf/httpd.conf文件中的“Servername”的值設(shè)定為“l(fā)ocalhost”,并再次嘗試啟動httpd服務(wù)。
并調(diào)整防火墻以允許httpd服務(wù),從遠程客戶端訪問。
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https
重新啟動firewalld服務(wù):
firewall-cmd --reload
打開瀏覽器,輸入服務(wù)器IP訪問:
安裝 MariaDB
Fedora 23/22 用戶安裝命令:
dnf install mariadb mariadb-server -y
Fedora 21 及早前版本命令:
yum install mariadb mariadb-server -y
隨系統(tǒng)自動啟動命令:
systemctl enable mariadb
啟動數(shù)據(jù)庫服務(wù)器:
systemctl start mariadb
設(shè)置 MariaDB root 賬戶密碼,默認情況下MySQL root用戶的密碼為空。因此,以防止未經(jīng)授權(quán)的訪問MySQL數(shù)據(jù)庫,我們設(shè)置需要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!
安裝 PHP
Fedora 23/22 用戶命令:
dnf install php -y
Fedora 21 及早期版本:
yum install php -y
測試PHP是否運行:
vi /var/www/html/testphp.php
輸入以下內(nèi)容:
重啟 Http 服務(wù):
systemctl restart httpd
瀏覽器輸入看看:
安裝PHP模塊
搜索模塊并安裝:
Fedora 23/22 用戶:
dnf search php
Fedora 22及早期版本:
yum search php
現(xiàn)在安裝你所選擇所需模塊,例如php-mysql,使用以下命令:
Fedora 23/22 用戶:
dnf install php-mysql -y
Fedora 22及早期版本:
yum install php-mysql -y
重啟 HTTP 服務(wù):
systemctl restart httpd
瀏覽器查看模塊安裝是否成功:
安裝 phpMyAdmin
phpmyadmin 用于管理數(shù)據(jù)庫:
Fedora 23/22 用戶:
dnf install phpmyadmin -y
Fedora 22及早期版本:
yum install phpmyadmin -y
缺省情況下,phpMyAdmin 只能從本地主機進行訪問。若要從遠程系統(tǒng)訪問您的網(wǎng)絡(luò)中,請執(zhí)行下列操作步驟。
vi /etc/httpd/conf.d/phpMyAdmin.conf
查找并注釋掉127.0.0.1 和請求 ip ::1 lines。然后添加一個額外的行要求所有授予略低于為注釋行。
這是我的更改后的 phpMyAdmin.conf 文件。這些變化以粗體標(biāo)記。
[...] 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以外的人訪問數(shù)據(jù)庫,應(yīng)視為危險,除非通過SSL適當(dāng)保護。做到這一點需要您自擔(dān)風(fēng)險。
保存并關(guān)閉文件。重新啟動httpd服務(wù)。
systemctl restart httpd
OK,打開 phpmyadmin 測試一下:
一些人借用LAMP來描述一類可定制組成的系統(tǒng),而不是制造一系列新詞,并用它來表示這些系統(tǒng)和統(tǒng)一打包的頁面開發(fā)環(huán)境的不同。
以上就是Fedora 23怎么安裝LAMP服務(wù)器,小編相信有部分知識點可能是我們?nèi)粘9ぷ鲿姷交蛴玫降摹OM隳芡ㄟ^這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。