之前整过CentOS,整了Ubuntu才发现,Ubuntu简单多了~~不知道性能相比又如何。
以Ubtuntu 14.04为例,记录一下搭建流程。
一、安装注意点 1. IP地址安装时先不要插网线,不然会DHCP,后续配置起来也麻烦
2. 硬盘分区自动分区貌似有:/、swap、efiswap、/boot(200MB)
实际两个区就足够了:swap为内存的1~2倍大小,剩余皆为/
装完后一般远程连接,需要配置ip地址,以下是多ip配置。(安装时会以向导形式配好一个IP,修改时只要复制粘贴就可以)
vi /etc/network/interfaces配置信息:
# The primary network interface auto em0 iface em0 inet static address 192.168.1.1 netmask 255.255.252.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.8.254 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 8.8.8.8 8.8.8.9 # dns-search 163.com # The second network interface auto em1 iface em1 inet static address 192.168.1.2 netmask 255.255.252.0 network 192.168.1.0重启网卡(貌似不一定生效,reboot肯定可以)
/etc/init.d/networking restart 三、SSH服务器默认安装后vi /etc/ssh/sshd_config,修改配置文件。
安全起见,可以建立允许列表:
先更新源,用以Trusty Tahr (14.04)为例,其他版本看配置生成器
deb trusty main restricted universe multiverse deb trusty-security main restricted universe multiverse deb trusty-updates main restricted universe multiverse deb trusty-proposed main restricted universe multiverse deb trusty-backports main restricted universe multiverse deb-src trusty main restricted universe multiverse deb-src trusty-security main restricted universe multiverse deb-src trusty-updates main restricted universe multiverse deb-src trusty-proposed main restricted universe multiverse deb-src trusty-backports main restricted universe multiverse再更新apt-get
apt-get update sudo apt-get upgrade然后更新系统并重启
sudo apt-get install update 五、Samba安装网上邻居默认安装 apt-get install samba
为samba创建ubuntu系统已经存在的用户somebody:
smbpasswd -a somebody然后会提示你输入密码,这是访问网上邻居文件夹的密码。
3. 修改配置文件:
在其后增加共享目录:
[share] path = /home/somebody/samba_share available = yes browseable = yes public = no writable = yes重启samba就可以像windows一样访问
/etc/init.d/samba restart 六、安装apache2 apt-get install apache2装好后访问就可以看到“It Works!”
apache2配置文件在/etc/apache2/apache2.conf,web目录在/var/www/html
默认用户是www-data,定义在./envvars文件中
其他配置文件在:./sites-enabled/*.conf
七、安装mysql apt-get install mysql-server mysql-client安装过程需要设置root的密码。Ubuntu下,MySQL的配置信息在/etc/mysql目录
MySQL默认的字符集是latin1:
为了避免中文可能带来的乱码问题,将默认字符集改成utf-8,具体可以参考这篇文章,修改 /etc/mysql/my.cnf 文件,在相应位置添加: [client] default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld] collation-server = utf8_unicode_ci init-connect='SET NAMES utf8' character-set-server = utf8
修改后是这样的:
OK! It Works!
------------------------------------分割线------------------------------------
CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境
Windows 7下硬盘安装Ubuntu 14.10图文教程
Ubuntu 14.04 LTS 如何升级到 Ubuntu 14.10
------------------------------------分割线------------------------------------