安裝作業系統
(選擇 LAMP)
apt-get update
sudo apt-get install build-essential
令安裝 LAMP
sudo apt-get install apache2 php5 mysql-client-5.0 mysql-server-5.0 phpmyadmin libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql
相關連結:
Ubuntu 完整說明
安裝 SSH
測試 SSH
安裝 FTP
sudo apt-get install vsftpd
sudo /etc/init.d/vsftpd start
測試 FTP
系統備份
備份:
tar -cvpzf /media/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys --exclude=/media /
還原:
tar -xvpzf /media/backup.tgz -C /
(如果您使用的是bz2压缩的:
tar -xvpjf /media/backup.tar.bz2 -C /)
安裝系統監看
- 安裝snmpd:
$ apt-get install snmpd
接著編輯設定檔$ vim /etc/snmp/snmpd.conf
大約第60行的地方, 改成像下面這個樣子:# sec.name source community
#com2sec paranoid default public
com2sec readonly default public
#com2sec readwrite default private
接著在大約第109行的地方, 編輯syslocation和syscontact, syslocation後面接主機的名稱, syscontact後面則接管理者的聯絡資料, 這兩樣設定只作識別用途, 可以隨意設定, 存檔後執行$ /etc/init.d/snmpd restart
讓設定檔生效. - 安裝cacti和rrdtool:
$ apt-get install cacti
http://bwchc.com/blog/?p=74
安裝webmin 管理介面
Installing Webmin in Ubuntu
You can use the above procedure but if you want to install latest version you can download from webmin site download section
Prerequisites
Perl 5 interpreter and libnet-ssleay-perl
#apt-get install perl5 libnet-ssleay-perl
Now you need to download the latest webmin from the above downloadlink
Download ‘webmin-1.290.tar.gz’ (at the time of writing) to some location in your machine ex:- /usr/local/src
#wget http://prdownloads.sourceforge.net/webadmin/webmin-1.290.tar.gz
#cd /usr/local/src
#tar xzvf webmin-1.290.tar.gz
#cd webmin-1.290
#sh setup.sh
This will start the installation and now it will prompt for several questions answer them as follows
Config file directory [/etc/webmin]:
Leave as default, or change as you wish
Log file directory [/var/webmin]:
Leave as default, or change as you wish
Full path to perl (default /usr/bin/perl):
Leave as default, or change as you wish
http://www.debianadmin.com/webmin-installation-and-configuration-in-debian-and-ubuntu-linux.html
Add the following to /etc/sysctl.conf:
kernel.panic = 20
安裝 Ruby on Rails
注意應用程式目錄的檔案屬性(包括母目錄,否則會有 You don't have permission to access / on this server 的錯誤。ex:
sudo rails test
sudo chown -R www-data:www-data test
應用程式放上去後,試試 rake db:migrate 檢查權限,如果這裡有問題,會發現 mysql 的權限可能有誤。
特定版本的 rails 設定
安裝:
最新版本:
sudo gem install rails
sudo gem install rails --version 2.0.2
將特定版本的 rails 放在該 ap 下
rake rails:freeze:edge TAG=rel_2-0-2
ps. 需要安裝 svn
sudo apt-get install subversion
rake rails:unfreeze
目前直接安裝 2.1
會出現 javascripts 及stylesheets 兩個目錄的檔案無法讀取。結果網站可以運作(特別的是 ajax 可以),但是會以赤裸的 html 出現。解決方法:刪除 public 目錄裡的 .htaccess 即可。
ImageMagick Support
vi /etc/apache2/httpd.conf
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so
RailsSpawnServer /usr/lib/ruby/gems/1.8/gems/passenger-1.0.5/bin/passenger-spawn-server
RailsRuby /usr/bin/ruby1.8
<VirtualHost *>
ServerName xuelele.com.tw
DocumentRoot /home/[user]/www/[ap]/public
</VirtualHost>
其他:磁碟管理工具
sudo apt-get install gparted
sudo apt-get install mysql-server
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install php5-mysql
sudo apt-get install phpmyadmin
sudo gem update --system
Which introduced this error:
/usr/bin/gem:23: uninitialized constant Gem::GemRunner(NameError)
whenever I tried to run rubygems. On the rails forum, I found a fix for it!
Simply add the line to the file /usr/bin/gem (may be different on a mac)
require 'rubygems/gem_runner'
after
require 'rubygems'