linux部署lamp,samba,nfs
實驗拓撲圖
實驗要求
- 五臺機器使用linux模擬
- 一臺機器做數據庫服務器,samba共享服務器,nfs共享服務器
- 其中兩臺做http服務器
- 一臺做PC機
實驗目的
samba服務器向一臺http服務器提供共享服務,做http的DocumentRoot,nfs服務器一樣作為另一臺http服務器的DocumentRoot,數據庫提供http的數據存儲服務。使PC訪問是正常的
實驗步驟
1. mysql服務器,nfs服務器,samba服務器
yum install -y mysql-server nfs-utils samba httpd php php-mysql ##安裝所需要的軟件
配置samba,并驗證啟動服務
systemctl start smb ##啟動samba服務 vi /etc/samba/smb.conf ##編輯samba的配置文件 [linux] comment = linux samba ##描述信息 path = /app/samba ##samba的路徑 broseable = yes ##是否可以瀏覽 writable = yes ##是否可寫 guest ok = yes ##來賓用戶可以查看 weite list = apache root ##可寫用戶列表 useradd centos ##增加用戶 smbpasswd -a cnetos ##為用戶centos添加samba的訪問密碼, pdbedit -L ##查看samba有沒有名為centos的用戶 smbclient -L 10.0.0.99 ##查看samba有沒有共享名為linux的共享文件
配置nfs,并驗證啟動服務
systemctl start nfs ##啟動nfs服務 vi /etc/exportfs ##編輯nfs文件 /app/nfs 10.0.0.102(rw,async) ##nfs共享的路徑以102客戶端可以訪問,以及他的權限 exportfs -ar ##導出nfs文件 showmount -e 10.0.0.99 ##查看是否共享
配置mysql或者mariadb服務
systemctl start mysqld(mariadb) ##啟動mysql或者mariadb服務 mysql(mariadb) ##直接輸入mysql或者mariadb,是以root用戶登錄localhost的mysql mysql>update user set password=password('123456') where user='root'; ##更改root密碼一邊使用phpmyadmin軟件管理 mysql>grant all privileges on *.* to root@"127.0.0.1" identified by "123456"; ##授權root可以本地登錄管理數據庫 mysql>create database wp_db; ##創建其中一臺http服務器使用的數據庫 mysql>create database dc_db: ##創建另一臺http服務器所使用的數據庫 mysql>grant all privileges on wp_db.* to wpuser@"%" identified by "123456"; ##授權http服務器可以以wpuser的用戶管理wp_db數據庫 mysql>grant all privileges on dc_db.* to dcuser@"%" identified by "123456"; ##授權http服務器可以以dcuser的用戶管理dc_db數據庫 mysql>flush privileges; ##刷新授權表 mysql>exit ##退出
重啟服務
systemctl restart mariadb nfs smb ##重啟服務 netstat -taunl ##查看端口3306/tcp、2049/tcp、137-138/udp,139/tcp,445/tcp有沒有監聽
安裝phpMyadmin
systemctl start httpd ##啟動http服務 cp phpmyadmin /var/www/html/ ##拷貝文件至http的根目錄 打開瀏覽器輸入IP地址進行管理mysql,用戶:root密碼:123456 打開后會提示錯誤需要安裝php-mbstring yum install -y php-mbstting
2. http服務器
配置http服務,進行wordpress博客系統的配置
yum install -y nfs-utils httpd php php-mysql ##安裝http服務器所需要的軟件 mount -t nfs 10.0.0.99:/app/nfs /var/www/html ##掛載共享的nfs文件 systemctl start httpd ##啟動http服務 cp wordpress /var/www/html ##copy軟件到http根目錄 打開瀏覽器輸入IP地址。 第一頁是一些基本,點確定。 第二個頁面是輸入數據庫的配置,將配置好的帳號密碼填入。 之后彈出可以配置的提示信息,確認 在一頁是配置站點的基本信息以及管理員的帳號密碼
配置另一臺http服務器,進行discuz的安裝
yum install -y nfs-utils httpd php php-mysql ##安裝http服務器所需要的軟件 mount -t cifs //10.0.0.99/linux -o username=centos,password=123456 /var/ww/html ##掛載samba服務共享的文件夾 systemctl start httpd ##啟動http服務 進入頁面配置discuz論壇系統
原創文章,作者:oranix,如若轉載,請注明出處:http://www.www58058.com/74604