2016年8月15日 星期一

在 Linux mint 中安裝Office 2010 32位元版本

設定目標:
  • 在Linux Mint 中,安裝 MS-Office 2010 32位元版本。
  • 注意:請購買合法的 Office 2010 使用授權(別肖想你可以買到原始碼!)
快速設定流程:
  1. 首先,安裝 Linux Mint 作業系統!

  2. 安裝 Wine 套件
    # add-apt-repository ppa:wine/wine-builds
    # apt-get install --install-recommends winehq-devel
    # apt-get -y --no-install-recommends install winehq-staging winbind
    
  3. 設定 winecfg 內容:
    # export WINEARCH=win32 WINEPREFIX=~/wineoffice
    # winecfg   (注意:使用 windows xp 當容器)
    
    選擇"函式庫" --> 新增 riched20 到函式庫內
    
  4. 掛載 MS-Office 2012 32位元版的光碟:
    # mount -o loop office2010.iso /mnt
    
  5. 利用 Wine 進行安裝的工作:
    # cd /mnt
    # wine setup.exe
    
參考文獻:
  • https://forums.solydxk.com/viewtopic.php?t=5857
  • https://community.linuxmint.com/tutorial/view/1325

2016年8月2日 星期二

在 CentOS7 / RHEL7 上使用 Collectd 外掛套件

設定目標:
  • 開啟 Collectd 外掛程式,即時監控多部系統主機資源運作情形!
  • 相關 Collectd 套件安裝方式,請參考這一篇內容
快速設定流程:
  1. 利用 yum 進行相關套件安裝(Server、Client端均需要安裝):
    #yum -y install collectd-netlink
    
  2. 編修 Server 端設定:
    #vim /etc/collectd.conf
    LoadPlugin network
    <Plugin network>
       Listen "192.168.1.63"
       <Listen "192.168.1.63">
          SecurityLevel None
       </Listen>
    </Plugin>
    
  3. 重新啟動 Collectd 服務:(Server)
    #systemctl restart collectd
    
  4. 設定 SELinux:(Server)
    #setsebool -P collectd_tcp_network_connect on
    
  5. 設定防火牆:(Server)
    #firewall-cmd --permanent --add-port=udp/25826
    #firewall-cmd --permanent --add-port=tcp/25826
    #firewall-cmd --reload
    
  6. 編修 Client 端設定:
    vim /etc/collectd.conf
    LoadPlugin network
    <Plugin network>
         Server "192.168.1.63"
         <Server "192.168.1.63">
                SecurityLevel None
         </Server>
    </Plugin>
    
  7. 重新啟動 Collectd 服務:(Client)
    #systemctl restart collectd
    
  8. 設定 SELinux:(Client)
    #setsebool -P collectd_tcp_network_connect on
    
  9. 驗證方式(Server、Client端均可使用):
    #netstat -tunlp | grep collect
    

2016年7月31日 星期日

在 CentOS7/RHEL7 上架設 Nginx Web Server(二)

設定目標:
  • 在 Centos 7 上架設 Nginx 1.10.1 + Php 7.0 (Remi) 套件!
Nginx Web Server 快速設定流程:
  1. 編寫最新的 Nginx 套件位置:
    #vim /etc/yum.repos.d/nginx.repo
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/7/$basearch/
    gpgcheck=0
    enabled=1
    
  2. 安裝最新的 Nginx 套件:
    # yum install nginx-*
    
  3. 開啟防火牆:
    # firewall-cmd --permanent --add-service=http
    # firewall-cmd --reload
    
  4. 啟動 Nginx 服務:
    #systemctl enable nginx.service
    #systemctl start nginx.service
    #systemctl status nginx.service -l
    
PHP 7 (Remi) 快速設定流程:
  1. 安裝 Remi 套件的 repo 檔案:
    #wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    #rpm -Uvh remi-release-7.rpm
    
  2. 安裝 PHP 7.0 套件:
    # yum install php70 php70-php-fpm php70-php-mbstring php70-php-mcrypt php70-php-gd
    
  3. 修改 php-fpm 設定檔:
    #vim /etc/opt/remi/php70/php-fpm.d/www.conf
    user = nginx
    group = nginx
    listen = /var/run/php-fpm.sock
    listen.owner = nginx
    listen.group = nginx
    listen.mode = 0666
    
  4. 啟動 php-fpm 服務:
    # systemctl enable php70-php-fpm.service
    # systemctl start php70-php-fpm.service
    
  5. 修改 Nginx 設定檔:
    # vim /etc/nginx/conf.d/default.conf
    (修改下列設定:)
        access_log  /var/log/nginx/access.log  main;
        error_log /var/log/nginx/error.log warn;
        
        location / {
            root   /usr/share/nginx/html;
            index  index.php index.html index.htm;
        }
    
        location ~ \.php$ {
            root           /usr/share/nginx/html;
        #    fastcgi_pass   127.0.0.1:9000;
            fastcgi_pass unix:/var/run/php-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
        :
        :
    
  6. 動新啟動 nginx:
    #systemctl restart nginx.service
    
  7. 開啟 SELinux 設定:
    #setsebool -P httpd_can_network_connect on
    

2016年7月30日 星期六

在 CentOS7/RHEL7 上使用 Collectd 套件

設定目標:
  • 即時監控系統資源運作情形!
快速設定流程:
  1. 利用 yum 進行相關套件安裝:
    #yum -y install collectd.x86_64 collectd-web collectd-rrdtool collectd-notify_email
    
  2. 啟動 Collectd 服務:
    #systemctl enable collectd
    #systemctl start collectd
    
  3. 複製 Collectd 的網頁檔案至網頁目錄:
    #cd /usr/share/nginx/html/
    #git clone https://github.com/pommi/CGP.git
    #mv CGP Collectd
    
  4. 打開 Firefox 查看網頁即可!
    # firefox http://localhost/Collectd
    
    ※注意:本次實作未考慮 SELinux 的影響!
  5. 若考慮 SELinux 的限制,需使用下列指令:
    #setenforce 0
    # grep php-fpm /var/log/audit/audit.log | audit2allow -M mypol
    # semodule -i mypol.pp
    # grep rrdtool /var/log/audit/audit.log | audit2allow -M mypol
    # semodule -i mypol.pp
    #setenforce 1
    
    ※注意:上述步驟需要不停的重試,直到網站運作正常為止!
Plugin套件快速設定流程:
※以收集 Nginx 連線資料為例:
  1. 安裝 Nginx for Collectd 套件:
    #yum -y install collectd-nginx
    
  2. 查詢 nginx 是否有支援 stub_status 模組:
    #nginx -V 2>&1 | sed 's,--,n--,g' | grep stub_status
    
  3. 修改 Collectd 設定檔:
    #vim /etc/collectd.d/nginx.conf
    <LoadPlugin nginx>
          URL "http://192.168.5.104/nginx_status?auto"
          User "nginx"
    #      Password "secret"
    #      CACert "/etc/ssl/ca.crt"
    </plugin>
    
    
  4. 修改 Nginx 設定檔:
    # vim /etc/nginx/conf.d/default.conf
    (追加設定:)
    location /nginx_status {
          stub_status on;
          access_log off;
          allow 192.168.4.0/23;
          deny all;
        }
    
    
  5. 重新啟動相關服務
    #systemctl restart collectd
    #systemctl restart nginx
    
  6. 設定 SELinux:
    #setsebool -P collectd_tcp_network_connect on
    
  7. 打開 firefox 查看結果!

參考文獻:

2016年7月29日 星期五

在 CentOS7/THEL7 上最佳化 Nginx Web Service

參考文獻:

  1. http://www.linuxde.net/2013/08/15150.html#comments
  2. https://blog.longwin.com.tw/2013/02/nginx-add-worker_connections-2013/

2016年7月26日 星期二

在 CentOS7/RHEL7 上安裝 MariaDB 10.1

快速設定流程:
  1. 編寫 yum 檔案:
    #vim /etc/yum.repos.d/MariaDB.repo
    [mariadb]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.1/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1
    
  2. 安裝 MariaDB 10.1 套件:
    #yum install MariaDB-*
    
  3. 啟動 MariaDB :
    # systemctl enable mariadb
    # systemctl start mariadb
    
  4. 啟動防火牆設定:
    # firewall-cmd --permanent --add-service=mysql
    # firewall-cmd --reload
    
  5. 始初化 MariaDB 的 root 密碼:
    #  mysql_secure_installation
    
參考網址:
  • https://mariadb.com/kb/en/mariadb/yum/
  • 2016年7月25日 星期一

    在 CentOS7/RHEL7 上架設 Piwik

    設定目標:
    • 在 Centos 7 上安裝 Piwik 套件,監控 Web 主機網路流量!
      • 請參考這一篇的設定,架設好 Web Server!
      • 請參考這一篇的設定,架設好 Mariadb Server !
    快速設定流程:

    1. 上網抓下 piwik 套件:
      #wget https://builds.piwik.org/piwik.zip
      
    2. 解開 piwik 套件:
      #unzip piwik.zip
      
    3. 建立 piwik 快取目錄:
      # mkdir -p /var/www/html/piwik/tmp/cache/tracker/
      # chmod -R 777 /var/www/html/piwik/tmp/
      
    4. 利用 firefox 來進行安裝 piwik 的工作:
      #firefox 127.0.0.1/piwik
      

    5. 開始進行安裝畫面:

    6. 按照網頁上的要求,給予適當的設定:

    7. 輸入 MySQL 資料庫相關設定:

    8. 設定好資料庫相關資料後,會建行表格建立:

    9. 輸入管理者帳密:

    10. 輸入站台相關資料:

    11. Piwik 團隊提醒使用者,為了方便追踪流量,可以把下列程式,放入網頁程式入!如果需要用於大流量的網站,必須要求助 Piwik 團隊,他們會給予更快的程式碼!

    12. 安裝完成:

    13. 登入畫面的介面:

    參考文獻:

    1. https://piwik.org/docs/installation/