Ubuntu 11.04服务器安装全过程文字版

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 [email protected]:/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 &