顯示具有 12.04 標籤的文章。 顯示所有文章
顯示具有 12.04 標籤的文章。 顯示所有文章

2014年8月21日 星期四

[Linux] 安裝 nicstat @ Ubuntu 12.04

在 Ubuntu 14.04 只需用 atp-get install nicstat 即可,但在 12.04 就得自己編了:

$ sudo apt-get install gcc gcc-multilib
$ cd /tmp
$ wget -qO- http://nchc.dl.sourceforge.net/project/nicstat/nicstat-1.92.tar.gz | tar -xvzf -
$ cp /tmp/nicstat-1.92/Makefile.Linux /tmp/nicstat-1.92/Makefile
$ cd /tmp/nicstat-1.92 && make && sudo make install

2014年6月10日 星期二

[Linux] Apache Error Log: configuration error: couldn't perform authentication. AuthType not set!: / @ Ubuntu 12.04, Ubuntu 14.04

最近部署環境時,想要偷懶共用一個 apache 設定檔,由於 Ubuntu 14.04 預設是安裝 apache 2.4.7 而 Ubuntu 12.04 預設是安裝 Apache 2.2.2。

忘記是 apache 哪版開始,預設必須加上:

Order allow,deny
Allow from all



Require all granted

才能正常使用,然而這兩段剛好一個是 apache 2.2,另一個是 apache 2.4 使用,並且不相容,所幸,還有個解法...那就是 Satisfy Any 啦

<Directory /path/www>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None

        Order allow,deny
        allow from all

        Require all granted

        Satisfy Any
</Directory>

2014年2月12日 星期三

[Linux] System Monitor / Load Indicator @ Ubuntu 12.04 desktop

indicator-multiload

印象中以前用 Ubuntu 10.04 時,常把 System Monitor Loading 顯示在右上角,但用了 Ubuntu 12.04 時,由於 Desktop GUI 更新後,遲遲找不到用法 XD 今天才把它解掉 Orz

$ sudo apt-get install indicator-multiload

接著在 Dash Home 搜尋 System 就可以看到 System Load indicator。

設定登入啟動:

$ cp /usr/share/applications/indicator-multiload.desktop ~/.config/autostart

2014年2月11日 星期二

[Linux] VPN L2TP client mode @ Ubuntu 12.04 Desktop

持續惡搞網路中,這次換把一台 Ubuntu desktop 當成 VPN Client 去連線。

$ sudo apt-add-repository ppa:werner-jaeger/ppa-werner-vpn
$ sudo apt-get update
$ sudo apt-get install l2tp-ipsec-vpn

註:若採用 Ubuntu 12.04 內建的 apt-get source list 安裝 l2tp-ipsec-vpn 後,卻連不上 :P

接著到左上角的 Dash Home 搜尋 VPN 來用:

vpn_client_setting_0

接著,就可以依序填寫資料:

vpn_client_setting_1

vpn_client_setting_2

填寫完記得按 "OK" 與 "Close" 後,再去右上角的 L2TP Ipsec VPN Applet 去點選連線囉!

如果,進行的不順利,可以試著跑去 VPN Server 上,查看 logs ,而 logs 預設沒有啟動,要去修改:

$ sudo vim /etc/ipsec.conf
config setup
  # ...
  # Use this to log to a file, or disable logging on embedded systems (like openwrt)
  plutostderrlog=/var/log/ipsec.log

$ sudo touch /var/log/ipsec.log
$ sudo service ipsec restart
ipsec_setup: Stopping Openswan IPsec...
ipsec_setup: Starting Openswan IPsec 2.6.37...
$ sudo tail -f /var/log/ipsec.log
added connection description "L2TP-PSK-noNAT"
listening for IKE messages
adding interface eth0/eth0 x.x.x.x:500
adding interface eth0/eth0 x.x.x.x:4500
adding interface lo/lo 127.0.0.1:500
adding interface lo/lo 127.0.0.1:4500
loading secrets from "/etc/ipsec.secrets"
loading secrets from "/var/lib/openswan/ipsec.secrets.inc"
...


如此一來,有人連線就會噴訊息囉。

2014年1月8日 星期三

[Linux] 簡易的測試機 - Nginx + Codeigniter + PHP + MySQL + PhpMyAdmin @ Linode Ubuntu 12.04 TLS

有點久沒在 Linode 打滾了,記得...我的信用卡還因為 Linode 的事件花錢換了一張新的 Orz 這次著重在測試機,所以先偷懶不裝防火牆

更新系統:

$ apt-get update && apt-get upgrade && apt-get dist-upgrade

簡易管理員:

$ adduser userid
$ vim /etc/group
sudo:userid


更新 hostname (建議不要有 "-",過去的經驗是 Hadoop 會找不到機器):

$ vim /etc/hostname
$ hostname -F /etc/hostname
$ vim /etc/hosts
127.0.1.1 YourName


簡易資安管理:

$ apt-get install denyhosts
$ vim /etc/hosts.allow
# whilelist
sshd: MyIP : allow


設定開發環境:

$ apt-get install nginx php5-cli php5-fpm mysql-server phpmyadmin

$ nginx -v
nginx version: nginx/1.1.19
$ php -v
PHP 5.3.10-1ubuntu3.9 with Suhosin-Patch (cli) (built: Dec 12 2013 04:27:25)
$ php5-fpm -v
PHP 5.3.10-1ubuntu3.9 (fpm-fcgi) (built: Dec 12 2013 04:31:25)


設定 nginx + PHP + Codeigniter:

$ vim /etc/nginx/sites-available/default
server {
# …
index index.html index.htm index.php;
# …
        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
 
                # With php5-cgi alone:
                fastcgi_pass 127.0.0.1:9000;
                # With php5-fpm:
                #fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
        # http://wiki.nginx.org/Codeigniter
        location /ci_proj/ {
               index index.html index.htm index.php;
               try_files $uri $uri/ /ci_proj/index.php;
        }
# …
}
$ service nginx restart


設定 nginx + PHPMyAdmin:

$ ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www/phpmyadmin
$ sudo service php5-fpm restart


其中 /etc/phpmyadmin/config-db.php 有標記預設登入的帳蜜,當然,也可以用當初設定 mysql 的 root 登入,建議新增帳號後,把 root 登入關掉, 共有兩處:

$ vim /etc/phpmyadmin/config.inc.php
/* Authentication type */
$cfg['Servers'][$i]['AllowRoot'] = FALSE;


其他資料庫匯入:

$ mysql -u db_account -p -D db_name < db_backup.sql