Ubuntu 12.04 安装之后
1,设置root密码
su password root
2,更新源
sudo apt-get update
sudo apt-get upgrade
//如果还是不能安装常用软件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.old (备份下当前的源列表)
cat /etc/issue (查看系统版本)
wget /etc/apt/sources.list (从网上到到对应版本的新源替换)
3,安装ssh 服务和 客户端
sudo apt-get install ssh-server
ps -e|grep sshd (查看是否启动)
sudo /etc/init.d/ssh start(启动)
vim /etc/ssh/sshd_config(把里面的Port参数修改成123即可)
sudo /etc/init.d/ssh restart (然后重启SSH服务)
4,添加用户
cat /etc/passwd 查看用户
cat /etc/group 查看组
adduser fj (添加用户,自动添加用户,组,主目录)
sudo groupadd -g 1002 abcgroup (添加组)
sudo useradd abcuser -g 1002 (添加用户到组)
sudo passwd abcuser (修改用户密码)
组用户加su权限
sudo usermod -a -G adm abcuser
sudo usermod -a -G sudo abcuser
编辑文件,组一个组添加sudo
/etc/sudoers
%abcgroup ALL=(ALL:ALL) ALL
5,安装php
sudo apt-get install php5 (apache2.2 php5.3.10)
apt-get install php5-cli php5-cgi php5-fpm php5-mcrypt php5-mysql
php5 -v( 查看安装版本)
httpd -V (查看apache版本及配置)
ps -aux | grep php-fpm (是否启动fpm)
netstat -tnl | grep 9000 (是否启动fpm tcp)
6,安装nginx
apt-get install nginx
nginx -V (查看配置)
修改配置文件
listen 80;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
7,安装mysql
sudo apt-get install mysql-server
ubuntu下mysql的配置文件为/etc/mysql/my.cnf,打开后,
在[client]段下添加:
default-character-set = utf8
在[mysqld]段下添加:
character_set_server = utf8
init_connect = 'SET NAMES utf8'
在[mysql]段下添加:
default-character-set = utf8
在[mysqld_safe]段下添加:
default-character-set = utf8
重启mysql后就能够支持中文了,重启命令为:
sudo /etc/init.d/mysql restart
可以在mysql下通过命令
myql -uroot -p
show variables like 'character%'
确认一下修改结果,如果显示如下内容