新聞中心
Fedora 23如何安裝LAMP服務(wù)器?LAMP其實(shí)就是Linux+Apache+PHP+MySQL環(huán)境,下面為大家演示一下在Fedora 23中安裝Fedora 23具體步驟。

綠園網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,綠園網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為綠園成百上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的綠園做網(wǎng)站的公司定做!
安裝 Apache
Apache 是一款開(kāi)源的 web 服務(wù)框架。完全支持 CGI, SSL。
切換到 root 賬戶:
su
Fedora 23/22 輸入以下命令來(lái)安裝Apache:
dnf install httpd -y
Fedora 21 及更早的版本:
yum install httpd -y
啟動(dòng)httpd服務(wù),以在每次系統(tǒng)啟動(dòng)服務(wù):
systemctl enable httpd
使用以下命令來(lái)啟動(dòng)httpd服務(wù):
systemctl start httpd
如果您遇到以下錯(cuò)誤:
Job for httpd.service failed. See ‘systemctl status httpd.service’ and ‘journalctl -xn’ for details.
刪除所有內(nèi)容在/etc/hostname,并加上“l(fā)ocalhost”。同時(shí),在/etc/httpd/conf/httpd.conf文件中的“Servername”的值設(shè)定為“l(fā)ocalhost”,并再次嘗試啟動(dòng)httpd服務(wù)。
并調(diào)整防火墻以允許httpd服務(wù),從遠(yuǎn)程客戶端訪問(wèn)。
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
重新啟動(dòng)firewalld服務(wù):
firewall-cmd --reload
打開(kāi)瀏覽器,輸入服務(wù)器IP訪問(wèn):
Fedora 23如何安裝LAMP服務(wù)器Fedora 23如何安裝LAMP服務(wù)器
安裝 MariaDB
Fedora 23/22 用戶安裝命令:
dnf install mariadb mariadb-server -y
Fedora 21 及早前版本命令:
yum install mariadb mariadb-server -y
隨系統(tǒng)自動(dòng)啟動(dòng)命令:
systemctl enable mariadb
啟動(dòng)數(shù)據(jù)庫(kù)服務(wù)器:
systemctl start mariadb
設(shè)置 MariaDB root 賬戶密碼,默認(rèn)情況下MySQL root用戶的密碼為空。因此,以防止未經(jīng)授權(quán)的訪問(wèn)MySQL數(shù)據(jù)庫(kù),我們?cè)O(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
測(cè)試PHP是否運(yùn)行:
vi /var/www/html/testphp.php
輸入以下內(nèi)容:
重啟 Http 服務(wù):
systemctl restart httpd
瀏覽器輸入看看:
Fedora 23如何安裝LAMP服務(wù)器Fedora 23如何安裝LAMP服務(wù)器
安裝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
瀏覽器查看模塊安裝是否成功:
Fedora 23如何安裝LAMP服務(wù)器Fedora 23如何安裝LAMP服務(wù)器
安裝 phpMyAdmin
phpmyadmin 用于管理數(shù)據(jù)庫(kù):
Fedora 23/22 用戶:
dnf install phpmyadmin -y
Fedora 22及早期版本:
yum install phpmyadmin -y
缺省情況下,phpMyAdmin 只能從本地主機(jī)進(jìn)行訪問(wèn)。若要從遠(yuǎn)程系統(tǒng)訪問(wèn)您的網(wǎng)絡(luò)中,請(qǐng)執(zhí)行下列操作步驟。
vi /etc/httpd/conf.d/phpMyAdmin.conf
查找并注釋掉127.0.0.1 和請(qǐng)求 ip ::1 lines。然后添加一個(gè)額外的行要求所有授予略低于為注釋行。
這是我的更改后的 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
[...]
重要提示:不過(guò)讓localhost以外的人訪問(wèn)數(shù)據(jù)庫(kù),應(yīng)視為危險(xiǎn),除非通過(guò)SSL適當(dāng)保護(hù)。做到這一點(diǎn)需要您自擔(dān)風(fēng)險(xiǎn)。
保存并關(guān)閉文件。重新啟動(dòng)httpd服務(wù)。
systemctl restart httpd
OK,打開(kāi) phpmyadmin 測(cè)試一下:
Fedora 23如何安裝LAMP服務(wù)器Fedora 23如何安裝LAMP服務(wù)器
好了,安裝完畢!
網(wǎng)頁(yè)標(biāo)題:Fedora23中安裝Fedora23具體步驟
新聞來(lái)源:http://www.fisionsoft.com.cn/article/dpjchdd.html


咨詢
建站咨詢
