http://www.dingl.com/blog/archives/12
作者:丁令
由于工作原因,需要搭建linux环境。
选择Ubuntu7.1 server的原因是比较干净,生产服务器上不要搞那么多乱七八糟的东西。
Ubuntu7.1 server是一个非常干净的系统,连图形界面都没有,于是鼠标用不上了。
安装Ubuntu非常简单,不再多述。注意几点:
1、安装之前先插上网线
2、除了OpenSSH,不装其它任何的服务器软件,Apache/Mysql/PHP都不装,后面使用源码自己编译安装
Ubuntu安装后的配置:
1、启用root用户
sudo passwd root
输入密码后:
su
即可用root用户完成后面的配置与维护。
2、配置网络
如果在安装时没有配置好网络环境,可手工配置:
vi /etc/network/interfaces
根据环境正确配置即可。重启网络:
/etc/init.d/networking restart
3、配置apt-get的更新位置
如果想使用最新版本的各种包,此步必须。
vi /etc/apt/sources.list
编辑文件,主要是禁止从cdrom安装软件,而从网上下载最新的版本。
#
# deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ – Release i386 (20071016)]/ gutsy main restricted
#deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ – Release i386 (20071016)]/ gutsy main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ubuntu.cn99.com/ubuntu/ gutsy main restricted
deb-src http://ubuntu.cn99.com/ubuntu/ gutsy main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://ubuntu.cn99.com/ubuntu/ gutsy-updates main restricted
deb-src http://ubuntu.cn99.com/ubuntu/ gutsy-updates main restricted
## 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
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://ubuntu.cn99.com/ubuntu/ gutsy universe
deb-src http://ubuntu.cn99.com/ubuntu/ gutsy universe
deb http://ubuntu.cn99.com/ubuntu/ gutsy-updates universe
deb-src http://ubuntu.cn99.com/ubuntu/ gutsy-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://ubuntu.cn99.com/ubuntu/ gutsy multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ gutsy multiverse
deb http://ubuntu.cn99.com/ubuntu/ gutsy-updates multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ gutsy-updates multiverse
## Uncomment the following two lines to add software from the ‘backports’
## repository.
## 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://ubuntu.cn99.com/ubuntu/ gutsy-backports main restricted universe multiverse
# deb-src http://ubuntu.cn99.com/ubuntu/ gutsy-backports main restricted universe 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 gutsy partner
# deb-src http://archive.canonical.com/ubuntu gutsy partner
deb http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb http://security.ubuntu.com/ubuntu gutsy-security universe
deb-src http://security.ubuntu.com/ubuntu gutsy-security universe
deb http://security.ubuntu.com/ubuntu gutsy-security multiverse
deb-src http://security.ubuntu.com/ubuntu gutsy-security multiverse
4、更新Ubuntu:
apt-get update
apt-get upgrade
此步需要花费大概30分钟,如果出现网络错误可重新执行或加上–fix-missing参数重新执行。
5、安装各种软件包
可一次安装N个:
apt-get install binutils cpp fetchmail flex gcc libarchive-zip-perl libc6-dev libcompress-zlib-perl libdb4.3-dev libpcre3 libpopt-dev lynx m4 make ncftp nmap perl perl-modules unzip zip zlib1g-dev autoconf automake1.9 libtool bison autotools-dev g++ build-essential
上面的命令要放在一行执行。这些包基本都是后面需要使用的或者平时也经常可以用到的,可根据自己需要选择。
6、安装libncurses5-dev
很多朋友在使用源码安装软件时在make时出现错误,就是因为没有安装这个包:
checking for termcap functions library… configure: error: No curses/termcap library found
解决办法:
apt-get install libncurses5-dev
7、增加ll别名
以前用fedora core时都有ll命令,Ubuntu下没有,很不习惯,只好自己设置:
vi ~/.bashrc
此文件中其实已经有别名的配置,只是已经注释掉了,去掉注释即可,同时为vi设置别名为vim。
alias ll=’ls -l’
alias la=’ls -A’
alias l=’ls -CF’
alias vi=’vim’