树莓派系统精简Wheezy-Raspbian

删除python_games目录服务器用不到

rm -rf python_games

删除桌面,浏览器,python等…

sudo apt-get purge x11-common midori lxde lxde-common lxde-core lxde-icon-theme lxinput lxpanel lxpolkit lxrandr lxsession-edit lxshortcut lxtask lxterminal xinit xserver-xorg xserver-xorg-video-fbdev desktop-base desktop-file-utils gnome-icon-theme gnome-themes-standard leafpad menu-xdg scratch xarchiver zenity leafpad dillo netsurf python3 python3-minimal

删除opt目录下的示范代码

sudo rm -rf opt

删除pyton…

sudo apt-get purge `sudo dpkg --get-selections | grep -v "deinstall" | grep python | sed s/install//`

清除剩余的x11组件

sudo apt-get purge `sudo dpkg --get-selections | grep -v "deinstall" | grep x11 | sed s/install//`

服务器也不需要音频组件

sudo apt-get purge `sudo dpkg --get-selections | grep -v "deinstall" | grep sound | sed s/install//`

接下来删除build-essential库

sudo apt-get purge gcc-4.4-base:armhf gcc-4.5-base:armhf gcc-4.6-base:armhf

删除不需要的键盘支持字体等…

sudo apt-get purge ca-certificates libraspberrypi-doc xkb-data fonts-freefont-ttf locales manpages

执行清洁

sudo apt-get autoremove
sudo apt-get clean

删除所有日志

cd /var/log/
sudo rm `find . -type f`

via

树莓派搭建LNMP环境

Raspberry Pi的固件有很多,我安装的是官方的Raspbian。配置ip。然后ssh上去后开始安装。

推荐root权限执行

sudo apt-get update
sudo apt-get install nginx php5-fpm php5-cli php5-curl php5-gd php5-mcrypt php5-mysql php5-cgi mysql-server

首次安装mysql的时候会提示输入密码,密码不要忘记就行了。
接下来我们来配置Nginx,首先打开配置文件,/etc/nginx/nginx.conf ,按照下面的配置进行修改。

worker_processes 1;

worker_connections 256;

gzip on;
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

接下来打开/etc/nginx/sites-available/default也是按照下面的配置进行修改。

server {
	listen 80;#Web服务端口号,大陆用户可能需要修改为81或8080等
	server_name raspiweb.dyndns.org;
	root /media/usb/www/;

	access_log	/var/log/nginx/localhost.access.log;
	#error_page	404 /404.html;

	if (!-e $request_filename)
	{
		rewrite ^(.*)$ /index.php$1 last;
	}

	location / {
		index  index.html index.htm index.php default.html default.htm default.php;
	}

	location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
		access_log	off;
		expires	1d;
	}

	location ~ .*\.php(\/.*)*$ {
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass unix:/var/run/php5-fpm.sock;
		fastcgi_index index.php;
		include fastcgi_params;
	}
}

下面是对mysql的调优,打开配置文件/etc/mysql/my.cnf修改以下几处。

[mysqld]
key_buffer = 16k
max_allowed_packet = 1M
thread_stack = 64K
thread_cache_size = 4
query_cache_limit = 1M
default-storage-engine = MYISAM

最后我们来配置php.ini,php-fpm,打开配置文件/etc/php5/fpm/php.ini和/etc/php5/fpm/php-fpm.conf修改以下几处。

memory_limit=16M
process.max=4

重启nginx。

sudo /usr/sbin/nginx -s reload

到这里我们的lnmp环境配置已经大功告成!接下来是安装phpmyadmin到指定目录~这里只讲如何配置lnmp。
via