但是卻發現 hiCloud 目前無法自己製作 image deploy,所以只好把該記的記下來。
下面就是一些重新演練的環境紀錄,供以後參考。
基本環境設定
先安裝 sshd、vim、screen
apt-get install openssh-server apt-get install vim apt-get install screen
設定目前機器的網路環境
vim /etc/network/interfaces
iface lo inet loopback auto lo auto eth1 iface eth1 inet dhcp 改成 iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1
升級系統
大致上是 apt-get update , apt upgrade 就可以解決。 一開始我是會用 apt-get 的 mirror 功能讓他自動依區育去挑 mirror,方法為在 /etc/apt/source.list 的最前面加上
deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse但不幸遇到 tw.archive.ubuntu.com 掛掉的問題的話,就到 官方mirror列表找自己的地區然後是Up to date的,這裡我是選國網自由軟體實驗室的mirror,然後把 /etc/apt/source.list 改成
# # deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ dists/precise/main/binary-i386/ # deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ dists/precise/restricted/binary-i386/ # deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ precise main restricted #deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ dists/precise/main/binary-i386/ #deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ dists/precise/restricted/binary-i386/ #deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ precise main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://free.nchc.org.tw/ubuntu/ precise main restricted deb-src http://free.nchc.org.tw/ubuntu/ precise main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://free.nchc.org.tw/ubuntu/ precise-updates main restricted deb-src http://free.nchc.org.tw/ubuntu/ precise-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://free.nchc.org.tw/ubuntu/ precise universe deb-src http://free.nchc.org.tw/ubuntu/ precise universe deb http://free.nchc.org.tw/ubuntu/ precise-updates universe deb-src http://free.nchc.org.tw/ubuntu/ precise-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://free.nchc.org.tw/ubuntu/ precise multiverse deb-src http://free.nchc.org.tw/ubuntu/ precise multiverse deb http://free.nchc.org.tw/ubuntu/ precise-updates multiverse deb-src http://free.nchc.org.tw/ubuntu/ precise-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://free.nchc.org.tw/ubuntu/ precise-backports main restricted universe multiverse deb-src http://free.nchc.org.tw/ubuntu/ precise-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu precise-security main restricted deb-src http://security.ubuntu.com/ubuntu precise-security main restricted deb http://security.ubuntu.com/ubuntu precise-security universe deb-src http://security.ubuntu.com/ubuntu precise-security universe deb http://security.ubuntu.com/ubuntu precise-security multiverse deb-src http://security.ubuntu.com/ubuntu precise-security multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu precise partner # deb-src http://archive.canonical.com/ubuntu precise partner ## Uncomment the following two lines to add software from Ubuntu's ## 'extras' repository. ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. # deb http://extras.ubuntu.com/ubuntu precise main # deb-src http://extras.ubuntu.com/ubuntu precise main如果覺得太麻煩,網路上有自動產生器可以用。
建構網頁環境
安裝網頁伺服器(Lighttpd)
apt-get install lighttpd
安裝資料庫(MySQL)
apt-get install mysql-server
安裝 php
apt-get install php5-fpm
安裝 phpmyadmin
apt-get install phpmyadmin
將 php5-fpm 改成 unix-socket
vim /etc/php5/fpm/pool.d/www.conf * 找到以下將 listen 換成 php5-fpm.sock * ; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on ; a specific port; ; 'port' - to listen on a TCP socket to all addresses on a ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. ;listen = 127.0.0.1:9000 listen = /tmp/php5-fpm.sock
vim /etc/lighttpd/conf-enabled/15-fastcgi-php.conf * 將 lighttpd 的 fastcgi module 改成跑 fpm sock * fastcgi.server += ( ".php" => (( "socket" => "/tmp/php5-fpm.sock", "broken-scriptfilename" => "enable" )) )
遭遇錯誤
需要MDB2
Failed opening required 'MDB2.php': 解法 apt-get install php-mdb2
需要DataObject
Failed opening required 'DB/DataObject.php': 解法 pear install DB_DataObject pear install MDB2_Driver_mysqli
需要php5-geoip
[plugin] modifier 'geoip_country_code_by_name' is not implemented: 解法 apt-get install php5-geoip
安裝開發環境
安裝GCC
apt-get install gcc
安裝G++
apt-get install g++
安裝GDB
apt-get install gdb
安裝 GMake
apt-get install make
安裝subversion
apt-get install subversion
安裝 Google Protobuf
apt-get install protobuf-compiler libprotobuf-dev
安裝 Boost C++ Library
apt-get install libboost-all-dev
安裝 Poco C++ Library
apt-get install libpoco-dev
安裝 MySQL C API
當出現錯誤訊息找不到 mysql.h:apt-get install libmysqlclient-dev
安裝 CMake
apt-get install cmake
安裝 samba
apt-get install samba pdbedit -a USERNAME
設定 ulimit
vim /etc/security/limits.conf * soft core -1 * soft data 33554432 * soft fsize -1 * soft memlock -1 * soft nofile 40960 * soft rss -1 * soft stack 524288 * soft cpu -1 * soft as -1 * soft locks -1 root hard core 100000
設定 core dump filename
echo "%e.core.%s.%t"> /proc/sys/kernel/core_pattern 永久寫入 vim /etc/sysctl.conf kernel.core_pattern=%e.core.%s.%t
換掉 default editor
update-alternatives --config editor
備份與還原
安裝進度條
每次當我們在 unix-like 上執行某些操作,例如傳檔案、壓縮、解壓縮,總是很難知道現在還要等多久,所以可以透過pv 這支程式幫我們顯示進度條。apt-get install pv
備份資料庫
mysqldump -u username -p --add-drop-table --create-options --routines --default-character-set=utf8 DATABASE_NAME | pv | bzip2 -cq9 | pv > BACKUPFILENAME.sql.bz2
還原資料庫
pv BACKUPFILENAME.sql.bz2 | bunzip2 > BACKUPFILENAME.sql pv BACKUPFILENAME.sql | mysql -u username -p DATABASE_NAME
雜七雜八
看目前裝了什麼套件,類似FreeBSD 裡的 pkg_info
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n或是
sudo sed -ne '/^Package: (.*)/{s//1/;h;};/^Installed-Size: (.*)/{s//1/;G;s/n/ /;p;}' /var/lib/dpkg/status | sort -rn
請教一下:ubuntu好用?還是fedora好用?
回覆刪除看您對哪個 distro 用的順手,就哪個好用 :)
刪除