1.安装Ubuntu 11.04 Server 64位。
2.安装ssh服务
sudo apt-get install openssh-server
生成密钥
ssh-keygen
将公钥改名留在服务器上
mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
将私钥 id_rsa 从服务器上复制出来,并删除掉服务器上的 id_rsa 文件
scp ~/.ssh/id_rsa wangbin@192.168.0.XXX:/home/XXX/.ssh/id_rsa_local_101
rm ~/.ssh/id_rsa -f
3.设置静态ip地址:
vim /etc/network/interfaces
如果配置动态获取ip,则在上述文件中加入以下内容:
auto eth0
iface eth0 inet dhcp
如果配置静态ip,则添加如下内容:
auto eth0
iface eth0 inet static
address 192.168.33.201
netmask 255.255.255.0
gateway 192.168.33.1
要是配置生效,需要重启网卡:
ifconfig eth0 down
ifconfig eth0 up
若还有没有配置成功,则需重启下网络服务
/etc/init.d/networking restart
配置dns
vim /etc/resolv.conf
nameserver 202.112.125.53
修改计算机名
sudo vim /etc/hostname
sudo reboot
4.优化Ubuntu系统
修改语言,解决乱码问题
vim /etc/default/locale
LANG="zh_CN.UTF-8"
5.拷贝所需软件
将以下软件 mysql-5.1.53.tar.gz, php-5.3.3.tar.gz, eaccelerator-0.9.6-rc2.tar.bz2, nginx 拷贝到~/tmp/目录下
6.安装mysql
sudo groupadd mysql
sudo useradd -g mysql mysql
cd ~/tmp/
tar -zxvf mysql-5.1.53.tar.gz
cd mysql-5.1.53/
sudo apt-get install g++ gcc make automake perl
sudo apt-get install libncurses5-dev
./configure --prefix=/usr/local/webserver/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg
make
sudo make install
sudo mkdir /usr/local/webserver/mysql/data
sudo chown -R mysql:mysql /usr/local/webserver/mysql/data
sudo /usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/usr/local/webserver/mysql/data --user=mysql
/usr/local/webserver/mysql/bin/mysqld_safe &
/usr/local/webserver/mysql/bin/mysqladmin -uroot password XXX
sudo mkdir /usr/local/webserver/mysql/conf
sudo cp ~/tmp/mysql-5.1.53/support-files/my-small.cnf /usr/local/webserver/mysql/conf/my.cnf
/usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/usr/local/webserver/mysql/conf/my.cnf 2>&1 > /dev/null &7.安装php
cd ~/tmp/
tar -zxvf php-5.3.3.tar.gz
cd php-5.3.3/
sudo apt-get install libevent-dev
sudo apt-get install libxml2-dev
sudo apt-get install curl
sudo apt-get install libssl-dev
sudo apt-get install libcurl3
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libpng12-dev
sudo apt-get install libjpeg62-dev
sudo cp /usr/lib/x86_64-linux-gnu/libjpeg.* /usr/lib/
sudo cp /usr/lib/x86_64-linux-gnu/libpng* /usr/lib/
sudo apt-get install libfreetype6-dev
sudo apt-get install libmcrypt-dev
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir= --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-exif --enable-soap --without-pear --enable-fpm
make
sudo make install
sudo cp ~/tmp/php-5.3.3/php.ini-production /usr/local/webserver/php/etc/php.ini
sudo mv /usr/local/webserver/php/etc/php-fpm.conf.default /usr/local/webserver/php/etc/php-fpm.conf
sudo groupadd www
sudo useradd -g www www
sudo mkdir -p /www/webroot
sudo chmod +w /www/webroot
sudo chmod -R www:www /www/webroot
sudo chown -R www:www /www/webroot
#安装php扩展eaccelerator
cd ~/tmp/
tar -jxvf eaccelerator-0.9.6-rc2.tar.bz2
cd eaccelerator-0.9.6-rc2/
/usr/local/webserver/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config
make
sudo make install
#sudo vim /etc/sysctl.conf
#安装php扩展memcache
cd ~/tmp/
tar -zxvf memcache-2.2.6.tgz
cd memcache-2.2.6/
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
sudo make install
8.安装nginx
cd ~/tmp/
tar -zxvf nginx-0.8.53.tar.gz
cd nginx-0.8.53/
sudo apt-get install libpcre3-dev
./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module
make
sudo make install
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)