2016年3月29日 星期二

CentOS7/RHEL7上架設 Samba Server(2016.3.30上課內容)

CentOS7/RHEL7上架設 Samba Server


基本設定流程:

安裝 Samba Server 套件:#yum -y install samba

設定欲分享目錄:#mkdir /sharedpath

設定 SELinux 限定規則:#semanage fcontext -a -t samba_share_t '/sharedpath(/.*)?'
                                                #restorecon -RFvv /sharedpath

設定 Samba Server 設定檔:#vim /etc/samba/smb.conf
                                                   [global]
                                                   workgroup = WORKGROUP
                                                  interfaces = lo eth0 192.168.1.1/24
                                                 hosts allow = 127. 192.168.1.
                                                 [myshare]
                                                path = /sharedpath
                                               writable = no
                                               valid users = fred, @management

開啟 SELinux 存取規則:#setsebool -P samba_enable_home_dirs=on
                                    #restorecon -RFvv /sharedpath

在 Samba Server 上,検查設定項目是否正確:#testparm

在 Samba Server 上,新增一般的使用者帳號與密碼:#useradd -s /sbin/nologin fred

在 Samba Server 上,安裝管理使用者的套件:#yum -y install samba-client

在 Samba Server 上,設定可存取 Samba Server的使用者帳號與密碼:#smbpasswd -a fred
啟動 Samba Server:#systemctl start smb nmb 
                                     #systemctl enable smb nmb
在 Samba Server 上,開啟防火牆設定:#firewall-cmd --permanent --add-service=samba
                                                                        #firewall-cmd --reload
在 client 端,掛載 Samba Server 所分享目錄:#mkdir /mnt/myshare
                                                                                   #mount -t cifs -o username=fred //server/myshare /mnt/myshare

2016年3月21日 星期一

CentOS7/RHEL7:安裝MariaDB設定Web Server(2016.3.22上課內容)

CentOS7/RHEL7:安裝MariaDB設定Web Server


快速設定流程:

安裝 MySQL/MariaDB 套件:#yum -y install mariadb mariadb-server mariadb-bench

啟動 MySQL Server :#systemctl start mariadb.service
               #systemctl enable mariadb.service
查詢預設 root 密碼:#systemctl status mariadb -l
             #vim 

基本設定流程:

安裝 Web Server 套件:#yum -y install httpd

設定啟動 Web Server 服務:#systemctl enable httpd.service
                                          #systemctl start httpd.service
                                          #systemctl status httpd.service

設定開通防火牆(此步驟未開通將無法顯示網頁)#firewall-cmd --permanent --add-service=http
            #firewall-cmd --reload

Apache 相關設定檔案:

主要設定檔:/etc/httpd/conf/httpd.conf
設定檔目錄:/etc/httpd/conf.d/
網頁放置目錄:/var/www/html