安裝nginx,mysql檬果,php
建議使用lnmp一鍵安裝包安裝,方便快捷唐断。如果不用一鍵安裝包选脊,我估計(jì)得研究這一塊的東西大概一周吧。下面以一鍵安裝包為例脸甘。
獲取lnmp一鍵安裝包鏈接
找到下載頁面選擇最新的復(fù)制其鏈接恳啥。
最新版本信息如下:
LNMP1.4測試版http://soft.vpser.net/lnmp/lnmp1.4beta.tar.gz (131KB)MD5:bd851e151b2ba13c3a32c435efb1a76c最后更新:2017年2月14日14:18GMT+8
其中的http://soft.vpser.net/lnmp/lnmp1.4beta.tar.gz就是我們需要的鏈接,復(fù)制到剪貼板丹诀。
安裝
第一步:在vmware station上部署好centos7钝的,并使它聯(lián)網(wǎng),這是重中之重铆遭,一切根本硝桩。
部署完畢:
1、用putty連上本地虛擬機(jī)枚荣;
2碗脊、開始打命令;安裝lnmp1.4環(huán)境包
3橄妆、首先安裝wget #yum -y install wget
4衙伶、# 下載,后邊的路徑直接粘貼就好害碾。XShell上面復(fù)制快捷鍵是ctrl+insert矢劲,粘貼快捷鍵是Shift+insert,mac上面是我們熟悉的 command+c慌随,command+v wget http://soft.vpser.net/lnmp/lnmp1.4beta.tar.gz
5芬沉、解壓的話需要安裝解壓工具:yum -y install bzip2
6、# 解壓
7、tar -zxvf lnmp1.4beta.tar.gz
8花嘶、# 進(jìn)入lnmp目錄
9笋籽、cd lnmp1.4
10、# 執(zhí)行install.sh進(jìn)行安裝
11椭员、./install.sh
出現(xiàn)如下頁面:
依次輸入你要安裝的選項(xiàng)前的數(shù)字并回車即可下一步车海。
MySql 選項(xiàng)
You have5optionsforyour DataBase install.1: Install MySQL5.1.732: Install MySQL5.5.53(Default)3: Install MySQL5.6.344: Install MySQL5.7.165: Install MariaDB5.5.536: Install MariaDB10.0.287: Install MariaDB10.1.190:DONOT Install MySQL/MariaDBEnter your choice (1,2,3,4,5,6,7or0):
此處根據(jù)所需選擇,如果使用的上述服務(wù)器隘击,請選擇2或者直接回車侍芝。我選擇默認(rèn)。
注意:安裝MySql時(shí)埋同,如果選擇太高的版本安裝會被拒絕州叠,提示信息如下Memory less than 1GB, can't install MySQL 5.6, 5.7 or MairaDB 10!。根據(jù)個(gè)人手動安裝MySql5.7的經(jīng)驗(yàn)來看凶赁,此768MB內(nèi)存的服務(wù)器在運(yùn)行一個(gè)nginx咧栗,mysql,php時(shí)還好虱肄,倘若再運(yùn)行一個(gè)tomcat致板,mysql將會不定期down掉。所以此處選擇一個(gè)低版本的5.5MySql即可咏窿。
You will install MySQL5.5.53===========================Please setup root passwordofMySQL.(Default password: root)Please enter:
輸入密碼回車或直接回車斟或,直接回車默認(rèn)密碼為root。此處做實(shí)驗(yàn)我選擇默認(rèn)集嵌,個(gè)人實(shí)際使用請修改萝挤。
MySQL root password: root===========================Do you want toenableordisablethe InnoDB Storage Engine?Defaultenable,Enter your choice [Y/n]:
輸入Y或者n然后回車或直接回車,直接回車默認(rèn)啟用InnoDB存儲引擎根欧。我選擇默認(rèn)怜珍。
No input,The InnoDB Storage Engine will enable.===========================You have6optionsforyour PHP install.1: Install PHP5.2.172: Install PHP5.3.293: Install PHP5.4.454: Install PHP5.5.38(Default)5: Install PHP5.6.306: Install PHP7.0.157: Install PHP7.1.1Enter your choice (1,2,3,4,5,6or7):
輸入選項(xiàng)然后回車或者直接回車,直接回車默認(rèn)安裝PHP5.5.38版本凤粗。我選擇默認(rèn)绘面。
You will install PHP 7.1.1===========================You have 3 optionsforyour Memory Allocator install.1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
輸入選項(xiàng)然后回車或者直接回車,直接回車默認(rèn)不安裝內(nèi)存分配器侈沪。我選擇默認(rèn)揭璃。
此時(shí)出現(xiàn)
Press any key to install...orPress Ctrl+c to cancel
當(dāng)然是摁任意鍵啦,一般都是回車咯亭罪。
然后出現(xiàn)一大堆信息瘦馍。前幾行如下:
You will install lnmp stack.nginx-1.10.3mysql-5.5.53php-5.5.38Enable InnoDB: yPrintlnmp.conf infomation...Download Mirror: http://soft.vpser.netNginx Additional Modules: PHP Additional Modules: Database Directory: /usr/local/mysql/varDefaultWebsite Directory: /home/wwwroot/defaultCentOS release6.8(Final)Kernel \r on an \m
這一堆東西你就不用管啦。本次實(shí)驗(yàn)的開始時(shí)間23:04……經(jīng)過了漫長漫長漫長的等待之后……大概23:35結(jié)束应役。所以期間你去洗個(gè)澡看個(gè)電視劇都不是問題情组。然后我們看到屏幕上最后輸出的信息如下燥筷。
The service command supports only basic LSBactions(start, stop, restart,try-restart, reload, force-reload, status). For other actions, pleasetryto use systemctl.Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.Add Startup and Starting LNMP...Add nginx service at system startup...Starting nginx...? doneAdd mysql service at system startup...Starting MySQL... SUCCESS! Add php-fpm service at system startup...Starting php-fpm? done============================== Check install ==============================Checking ...Nginx: OKMySQL: OKPHP: OKPHP-FPM: OKClean src directory...+------------------------------------------------------------------------+|? ? ? ? ? LNMP V1.4forCentOS Linux Server, Written by Licess? ? ? ? ? |+------------------------------------------------------------------------+|? ? ? ? ? For more information please visit https://lnmp.org? ? ? ? ? |+------------------------------------------------------------------------+|? ? lnmp status manage: lnmp {start|stop|reload|restart|kill|status}? ? |+------------------------------------------------------------------------+|? phpMyAdmin: http://IP/phpmyadmin/? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ||? phpinfo: http://IP/phpinfo.php? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ||? Prober:? http://IP/p.php? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |+------------------------------------------------------------------------+|? Add VirtualHost: lnmp vhost add? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |+------------------------------------------------------------------------+|? Default directory: /home/wwwroot/default|+------------------------------------------------------------------------+|? MySQL/MariaDB root password: root? ? ? ? ? ? ? ? ? ? ? ? ? |+------------------------------------------------------------------------++-------------------------------------------+|? ? ManagerforLNMP, Written by Licess? ? |+-------------------------------------------+|? ? ? ? ? ? ? https://lnmp.org? ? ? ? ? ? |+-------------------------------------------+nginx (pid715713) is running...php-fpm is runing! SUCCESS!MySQLrunning(1247)Active Internetconnections(only servers)Proto Recv-Q Send-Q Local Address? ? ? ? ? Foreign Address? ? ? ? State? ? ? tcp? ? ? ? 0? ? ? 0 0.0.0.0:3306? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? tcp? ? ? ? 0? ? ? 0 0.0.0.0:80? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? tcp? ? ? ? 0? ? ? 0 0.0.0.0:22? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? tcp6? ? ? 0? ? ? 0 :::22? ? ? ? ? ? ? ? ? :::*? ? ? ? ? ? ? ? ? ? LISTEN? ? Install lnmp V1.4 completed! enjoy it.
簡單說明一下,此安裝過程安裝完成便也啟動了nginx院崇,mysql肆氓,php-fpm并加入了開機(jī)啟動項(xiàng)。如果重啟服務(wù)器底瓣,不需要再單獨(dú)手動開啟相關(guān)的服務(wù)了谢揪。總的來說相當(dāng)方便的捐凭。
關(guān)于Linux服務(wù)拨扶,自己之前做的筆記分享給大家。Linux 服務(wù)管理
這時(shí)候你在瀏覽器輸入http://IP例如http://192.168.1.117 便可以訪問了茁肠』济瘢看到的內(nèi)容如下:
網(wǎng)站根目錄路徑/home/wwwroot/default,如果只用來放一些靜態(tài)頁面,那么垦梆,現(xiàn)在就足夠了匹颤,直接將你的html,js托猩,css等文件丟進(jìn)去即可惋嚎。這不是本文重點(diǎn),在此不贅述了站刑。
退出使用ctrl+c
安裝discuz
下載discuz包
為了方便,我們還是在用站點(diǎn)默認(rèn)的路徑鼻百,但是我們投機(jī)取巧一下绞旅。
# 進(jìn)入根目錄上一級目錄cd /home/wwwroot/# 將default重命名為oldmvdefaultold# 下載discuz包wget http://download.comsenz.com/DiscuzX/3.3/Discuz_X3.3_SC_UTF8.zip然后我們解壓
unzip Discuz_X3.3_SC_UTF8.zip
# 查看解壓后的文件夾名,此處是upload温艇,估計(jì)應(yīng)該都是吧因悲,看看保險(xiǎn)啊這時(shí)我們目錄下有了這么幾個(gè)文件
[root@localhost~]# lsDiscuz_X3.3_SC_UTF8.zip? readme? upload? utility
# 將upload重命名為defaultmv uploaddefault# 再次查看檢驗(yàn)[root@vultr wwwroot]# ls
Discuz_X3.3_SC_UTF8.zip readme upload utility
給相應(yīng)目錄授權(quán)
# 目錄以及目錄下的文件授權(quán)[root@vultr wwwroot]# chown -R 755 /home/wwwrootchown:changing ownership of ‘/home/wwwroot/old/.user.ini’: Operationnotpermitted# 將目錄的所有者分給www組下的www用戶。[root@vultr wwwroot]# chown -R www:www /home/wwwroot/chown:changing ownership of ‘/home/wwwroot/old/.user.ini’: Operationnotpermitted
出現(xiàn)的提示大概是說有一個(gè)文件無法更改用戶分組和權(quán)限勺爱。不會影響你的discuz晃琳,忽略就好。
創(chuàng)建一個(gè)數(shù)據(jù)庫discuz
# 登錄數(shù)據(jù)庫mysql -u root -p# 輸入密碼默認(rèn)的話就是root琐鲁,否則就是你自己之前設(shè)置的那個(gè)# 登錄進(jìn)來之后卫旱,看到這樣一些東西Welcome to the MySQL monitor. Commandsendwith ;or\g.Your MySQL connection id is3Serverversion:5.5.53-log Source distributionCopyright (c)2000,2016, Oracleand/orits affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporationand/oritsaffiliates. Other names may be trademarks of their respectiveowners.Type'help;'or'\h'forhelp. Type'\c'to clear the current input statement.mysql># 不用理會上面的,創(chuàng)建我們的數(shù)據(jù)庫围段,比如名字為wordpress顾翼。記得加分號。mysql> create database wordpress;# 看一下奈泪,有沒有我們創(chuàng)建的數(shù)據(jù)庫mysql> show databases;# 大概看到如下內(nèi)容适贸。意味著這一步也沒問題灸芳。+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || wordpress |+--------------------+4rowsinset (0.01sec)# 退出mysqlexit
配置discuz
然后我們訪問
http://x.x.x.x/upload/install/index.php
之后我很順利進(jìn)入到填寫數(shù)據(jù)庫信息的頁面,順利安裝成功