Centos-LAMP安裝:修訂版本之間的差異
出自幸福奉學網
(由1名用戶作出的14個中途修訂版本未被顯示) | |||
第 5 行: | 第 5 行: | ||
一、安裝Apache | 一、安裝Apache | ||
− | + | *1.安裝httpd:yum install httpd ;[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ffba3e9d4-4184-45ba-bcd0-a7981e5adee7%2FUntitled.png?table=block&id=64132569-6b6e-4827-a5c0-30630c17333f&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=1850&userId=&cache=v2 圖示 01];[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F5655afba-e8ab-4eb8-875d-28df97d89174%2FUntitled.png?table=block&id=6e980b8a-0135-44be-9dba-1016661a8ad7&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=2000&userId=&cache=v2 圖示 02] | |
− | + | *2.開啟httpd:systemctl start httpd ;[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F72a95786-eba1-4190-b836-d6884d32be6c%2FUntitled.png?table=block&id=086d816e-8782-4c22-8b34-9a305d463aff&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=890&userId=&cache=v2 圖示] | |
− | + | ||
+ | *3.確認是否Apache是否運行:systemctl status httpd;[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Feda812c5-d38b-4365-b9ab-5e89342dcee2%2FUntitled.png?table=block&id=58101c92-fb96-42ce-8ce0-a951bef0b367&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=1880&userId=&cache=v2 圖示] | ||
+ | |||
+ | *4.啟動apache to start during system boot:systemctl enable httpd;[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ffc109199-50ca-41f6-8986-a85e5107f664%2FUntitled.png?table=block&id=046f7d9c-45ad-43be-a9a1-938f0287d520&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=2000&userId=&cache=v2 圖示] | ||
+ | |||
+ | 備註:需要設定防火牆讓http跟https通過,否則如果從本機開啟瀏覽器,會看不到apache網頁 | ||
+ | |||
+ | 開啟防火牆,讓 web (port:80, 443) 流量可以穿過 firewall | ||
+ | |||
+ | $ sudo firewall-cmd --permanent --zone=public --add-service=http | ||
+ | |||
+ | $ sudo firewall-cmd --permanent --zone=public --add-service=https | ||
+ | |||
+ | $ sudo firewall-cmd --reload | ||
+ | |||
+ | 5.打開Linux瀏覽器,輸入server的IP或數入localhost,看到以下畫面代表成功;[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fba582bcf-53f8-4b0d-aea1-d9a3173cb217%2FUntitled.png?table=block&id=09af0d79-0f43-4c8b-bf88-fd655f6d4bba&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=2000&userId=&cache=v2 圖示] | ||
+ | |||
+ | 二、安裝Mariadb [https://blog.xuite.net/tolarku/blog/542563206 參考網址] | ||
+ | |||
+ | *1. yum install mariadb-server mariadb;[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ffe01e362-8eab-4268-9db8-597f85a552ec%2FUntitled.png?table=block&id=cdb298c1-f6a7-4970-9a2e-df3cd5009210&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=1180&userId=&cache=v2 圖示01];[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F4a32c508-5468-4641-8094-d380c2980a72%2FUntitled.png?table=block&id=bc96340c-6c25-468b-a3e0-8bf62f8d922d&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=2000&userId=&cache=v2 圖示02] | ||
+ | |||
+ | *2.開啟Mariadb Server:systemctl start mariadb | ||
+ | |||
+ | *3.確認Mariadb Server是否開啟;[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F1ca710a1-d5b2-4eef-9947-21a8cebe7e81%2FUntitled.png?table=block&id=b442f1a0-2e6c-491e-a7b8-8ed3170140fc&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=2000&userId=&cache=v2 圖示01];[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F60c057dc-3b4c-4a1d-9a40-99749f3d3b54%2FUntitled.png?table=block&id=49b71b1d-7773-4821-8f5b-33882670eba2&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=2000&userId=&cache=v2 圖示02] | ||
+ | |||
+ | 4.啟動mariadb to start during system boot(開機時就啟動);[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F991ccf89-3331-492e-aeda-9b4e5e21c525%2FUntitled.png?table=block&id=b948cce4-1eaf-4a99-8c21-221242c7b5bb&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=1470&userId=&cache=v2 圖示] | ||
+ | |||
+ | *5.設定mariadb Secure(設定帳號密碼):mysql_secure_installation;[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ff324cba8-ec3c-4613-ae0d-2d559992335d%2FUntitled.png?table=block&id=4241b494-5570-489b-acb9-7225a359ac9d&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=1370&userId=&cache=v2 圖示] | ||
+ | |||
+ | 三、安裝PHP+mysql_extension | ||
+ | |||
+ | *1.安裝php及mysql套件:yum install php php-mysql ;[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F359f921b-e307-41dc-9b56-ef4f38f95c17%2FUntitled.png?table=block&id=92e76ddc-f804-4cdf-8022-169c3bd09b97&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=1470&userId=&cache=v2 圖示] | ||
+ | |||
+ | *2.測試php是否能用 | ||
+ | |||
+ | (1)到/var/www/html資料夾之後,新增一個php檔案 linux指定: touch test.php | ||
+ | |||
+ | cd /var/www/html | ||
+ | |||
+ | ---然後---- | ||
+ | |||
+ | cd touch test.php | ||
+ | |||
+ | ---再用vim開啟--- | ||
+ | |||
+ | vim test.php | ||
+ | |||
+ | (2)打入phpinfo(); 測試是否能開起來 | ||
+ | |||
+ | <?php | ||
+ | phpinfo(); | ||
+ | |||
+ | ?> | ||
+ | |||
+ | (3)記得Restart httpd,否則phpinfo不會正常顯示 | ||
+ | |||
+ | systemctl restart httpd | ||
+ | |||
+ | -------之後開始編輯-------- | ||
+ | |||
+ | |||
+ | |||
==3.幸福茶香== | ==3.幸福茶香== | ||
2022年6月12日 (日) 22:34的最新修訂版本
目錄 |
1.幸福奉學
1-1 Centos-LAMP安裝
2.幸福分享
一、安裝Apache
- 2.開啟httpd:systemctl start httpd ;圖示
- 3.確認是否Apache是否運行:systemctl status httpd;圖示
- 4.啟動apache to start during system boot:systemctl enable httpd;圖示
備註:需要設定防火牆讓http跟https通過,否則如果從本機開啟瀏覽器,會看不到apache網頁
開啟防火牆,讓 web (port:80, 443) 流量可以穿過 firewall
$ sudo firewall-cmd --permanent --zone=public --add-service=http
$ sudo firewall-cmd --permanent --zone=public --add-service=https
$ sudo firewall-cmd --reload
5.打開Linux瀏覽器,輸入server的IP或數入localhost,看到以下畫面代表成功;圖示
二、安裝Mariadb 參考網址
- 2.開啟Mariadb Server:systemctl start mariadb
4.啟動mariadb to start during system boot(開機時就啟動);圖示
- 5.設定mariadb Secure(設定帳號密碼):mysql_secure_installation;圖示
三、安裝PHP+mysql_extension
- 1.安裝php及mysql套件:yum install php php-mysql ;圖示
- 2.測試php是否能用
(1)到/var/www/html資料夾之後,新增一個php檔案 linux指定: touch test.php
cd /var/www/html
---然後----
cd touch test.php
---再用vim開啟---
vim test.php
(2)打入phpinfo(); 測試是否能開起來
<?php phpinfo();
?>
(3)記得Restart httpd,否則phpinfo不會正常顯示
systemctl restart httpd
之後開始編輯--------
3.幸福茶香
3-1
4.幸福彩虹
4-1