写下这篇文章只是为了让自己不要忘了装系统的和配置环境的过程,以及方便以后重装。

 

首先,安装ubuntu,很简单,选择一个磁盘进行安装。装完之后,修改源 vi /etc/apt/source.list,我一般改成香港的源,下面贴出我的源:
deb http://hk.archive.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://hk.archive.ubuntu.com/ubuntu/ karmic main restricted
deb http://hk.archive.ubuntu.com/ubuntu/ karmic universe
deb-src http://hk.archive.ubuntu.com/ubuntu/ karmic universe
deb http://hk.archive.ubuntu.com/ubuntu/ karmic multiverse
deb-src http://hk.archive.ubuntu.com/ubuntu/ karmic multiverse
deb http://security.ubuntu.com/ubuntu/ karmic-security restricted main multiverse universe
改完之后,就使用apt-get更新和安装吧。到此,ubuntu安装就算完成了。

在联想的sl400上面安装ubuntu并不是一件困难的事情,但是,如果你要把所有的硬件驱动都装好,也不是一件容易的事,当初我为了能装好热键驱动可是费了好些时间。
下面是转载的一篇文章:
文章转载:http://q.yesky.com/group/review-17874716.html

原始的文档:http://gianlucamagalotti.wordpress.com/2009/02/16/lenovo-thinkpad-sl-series-hotkeys/,我针对ubuntu进行了一些细微的修改。

1、下载源程序。
到http://github.com/tetromino/lenovo-sl-laptop/tree/master去下载Makefile 和lenovo-sl-laptop.c两个文件。可以下载tar包或zip包,下载完毕后解压缩,只需要其中的Makefile和 lenovo-sl-laptop.c 两个文件

2、编译、安装源程序。
打开终端,进入文件下载到的目录,用下面的命令进行编译(请不要用root用户编译,即不要用sudo)
代码:make all
再将编译好的驱动模块复制到驱动目录
代码:sudo cp lenovo-sl-laptop.ko /lib/modules/`uname -r`/kernel/drivers/misc
并重建模块间的依赖关系
代码:sudo depmod

3、禁用原来的thinkpad-acpi模块。
编辑/etc/modprobe.d/blacklist文件,
代码:sudo gedit /etc/modprobe.d/blacklist
在末尾加入下面这行内容
代码:blacklist thinkpad-acpi
保存,关闭。

4、设置模块自动加载(重启后生效)
在/etc/modules中加入一行lenovo-sl-laptop,或者用下面的命令:
代码:sudo sed -i '$alenovo-sl-laptop' /etc/modules

5、允许驱动管理屏幕背光
创建/etc/modprobe.d/lenovo-sl-laptop.conf
代码:sudo gedit /etc/modprobe.d/lenovo-sl-laptop.conf
加入一行
代码:options lenovo-sl-laptop control_backlight=1

6、手动加载模块
代码:sudo modprobe lenovo-sl-laptop


现在应该能用除Fn+F8(禁用/启用触摸板)以外所有的快捷键了,如果你遇到了关于背光控制的问题,请仿照第3步禁用video模块,并将 /etc/init.d/hotkey-setup文件中的echo 0 > /sys/module/video/parameters/brightness_switch_enabled一行删掉(如果有的话),并重新启动。

对于Fn+F8,按照以下步骤:
1、创建/etc/hal/fdi/policy/shmconfig.fdi
代码:sudo gedit /etc/hal/fdi/policy/shmconfig.fdi

2、加入下列内容,保存,关闭。
代码:<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
<match key="input.x11_driver" string="synaptics">
<merge key="input.x11_options.SHMConfig" type="string">True</merge>
</match>
</device>
</deviceinfo>

3、安装notify-send(这步我没有做,一样可以用)
代码:sudo apt-get install libnotify-bin

4、创建一个脚本来处理按下Fn+F8的事件
代码:sudo mkdir /usr/share/hotkey-setup/gconf-commands
sudo gedit /usr/share/hotkey-setup/gconf-commands/synaptic-touchpad-toggle
加入以下内容
代码:#!/bin/bash
STATE=`synclient -l | grep TouchpadOff | cut -f2 -d'=' | cut -c2`
PARAMS="-t 1500 -i /usr/share/pixmaps/gnome-user-interface.png"
if [ $STATE -eq 0 ] ; then
synclient TouchpadOff=1
notify-send $PARAMS "Touchpad <i>DISABLED</i>" "Touchpad has been <b><i>DISABLED</i></b>"
else
synclient TouchpadOff=0
notify-send $PARAMS "Touchpad <i>ENABLED</i>" "Touchpad has been <b><i>ENABLED</i></b>"
fi
保存,关闭
给脚本加上可执行权限
代码:sudo chmod uga+x /usr/share/hotkey-setup/gconf-commands/synaptic-touchpad-toggle
让GNOME在按下Fn+F8时执行脚本(注意,这会覆盖原来的command_1的值,可以在配置编辑器或者Ubuntu-Tweak里看到,你可以换成command_2~command_12)
代码:gconftool-2 -s --type string /apps/metacity/keybinding_commands/command_1 /usr/share/hotkey-setup/gconf-commands/synaptic-touchpad-toggle
gconftool-2 -s --type string /apps/metacity/global_keybindings/run_command_1 XF86Launch1

到此所有的热键就都可以用了

接下来就开始搭建环境吧。我是做php开发的,一般用到的是Nginx+php(fastcgi)+ mysql
原始文档:http://www.howtoforge.com/installing-nginx-with-php5-and-mysql-support-on-ubuntu-8.10, 原文是英文的,我转换成中文
1. 安装mysql
apt-get install mysql-server mysql-client
在安装的过程中,将会要求你输入密码, 这个密码是为用户root@localhost设置的,所以最好不要为空。
New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword


2.安装Nginx
在ubuntu9.10里面,nginx已经被添加到系统自带的包里面,所以你只需要运行下面的命令就行了。
apt-get install nginx
安装完之后,运行:
/etc/init.d/nginx start
注意,如果提示Permission denied,  请在命令前面加上 sudo, 即运行sudo /etc/init.d/nginx start
成功之后,在浏览器的地址栏输入localhost或者你的Ip就能看到一个页面,上面显示 Welcome to nginx!
如果看到的话,恭喜你,nginx安装成功了。  
如果你想设定nginx开机就启动的话,则运行update-rc.d nginx defaults

3.安装php5
我们可以通过php-cgi来使php工作,在ubuntu9.10上,同样提供了我们所需要的包,而我们仅仅需要运行下面的命令(对于你不需要的模块,你可以不安装):
apt-get install php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
安装完之后,编辑/etc/php5/cgi/php.ini,在文章的末尾加上这一行:cgi.fix_pathinfo = 1(当然,你可以随便加在那里)
在ubuntu里面。并没有单独的php-cgi守护进程,所以我们不的不安装lighttpd,使用spawn-fcgi做php-cgi的守护程序,下面就让我们来安装它:
apt-get install lighttpd
安装完lighttpd后,会提示你说80端口已经被使用,没关系,这是因为nginx占用了你的80的端口。
我们并不需要lighttpd.自然就不需要开机启动,让我们从开机启动项里面移除它:update-rc.d -f lighttpd remove(还记得我们为nginx添加开机启动吗?)

好了,现在我们就可以使用spawn-fcgi来启动监听在localhost端口为9000用户名为www-data用户组为www-data的一个php-cgi守护程序,
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid
当然,我们照样可以让这个进程开机启动,
编辑vi /etc/rc.local
在exit前添加/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid

好了。到了这里,你基本上就完成了了php(php-cgi)+nginx+mysql环境的搭建了。剩下的,就需要你对nginx配置的优化,以及根据具体情况来调整nginx的配置。参考nginx文档:http://wiki.codemongers.com/NginxFullExample,http://wiki.codemongers.com/NginxFullExample2
下面贴出我的nginx的配置:
user www-data;
worker_processes  5;

# [ debug | info | notice | warn | error | crit ]
error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    # multi_accept on;
}

http {
    include       /etc/nginx/mime.types;
#    access_log    /var/log/nginx/access.log;
    access_log off;
    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    include /etc/nginx/conf.d/*.conf;
    
    server{
            listen 80;
            server_name localhost;
        root   /data/htdocs;    
#        error_page 404 /404.html;
            location / {
            #root   /data/htdocs;
                       autoindex on;
                    #index index.php index.htm index.html;
               }
        location ~* (jpg|png|gif|js|swf)$ {
            expires 3d;
        }
#        location ~ ^/openwebmail {
#            root /var/www;
#            index index.html index.htm;
#        }
        location ~ \.php$ {
             fastcgi_pass   127.0.0.1:9000;
             fastcgi_index  index.php;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include        fastcgi_params;
         }
        location ~ ^/nginx$ {
                        stub_status             on;
                        #access_log              off;     
                }
    }
    server{
                listen 8080;
                server_name myfarm;
                root   /data/htdocs/myfarm;
        
#        if (!-f $request_filename) {
#            rewrite ^/([1-9][0-9]*)/([^/]*)/*$ /index.php?uid=$1&name=$2 break;
#            break;
#        }    
#        error_page 404 /404.html;    
                location / {
                       autoindex on;
#                       index index.php index.htm index.html;
                }
#        location / {
 #               proxy_pass   http://10.1.6.111;
#            #include /etc/nginx/proxy.conf;
#        }
#        location ~ \.php$ {
#            proxy_pass http://10.1.6.111;
                        #include /etc/nginx/proxy.conf;
#        }
        location ~ \.php$ {
                       fastcgi_pass   127.0.0.1:9000;
                       fastcgi_index  index.php;
                       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                       include        fastcgi_params;
                }
        }    
#    include /etc/nginx/sites-enabled/*;
}


记得修改了nginx的配置后,并不能马上生效,你必须的运行/etc/init.d/nginx reload 之后,新的配置才能生效。

测试以下吧。在根目录写一个info.php页面.
<?php
phpinfo();
?>
然后在地址栏输入http://localhost/info.php
如果安装都正确的话,页面上就会显示出你的php的配置信息。

 

ok.在sl400现安装ubuntu以及php的开发环境就完成了。 接下来,就享受ubuntu给你的开发带来的方便吧!!

 

 

posted on 2010-04-02 21:30  Junw_china  阅读(614)  评论(0编辑  收藏  举报