首页 > 代码库 > Ubuntu 14.04服务器安装及软件配置

Ubuntu 14.04服务器安装及软件配置

1、安装操作系统,配置root账号,通过sudo设置root的密码 如果使用ubuntu server 14.04,开启root需额外配置 

  1.开启root远程登录权限 

sudo vi /etc/ssh/sshd_config 

  将PermitRootLogin without-password 修改为PermitRootLogin yes 

  2.重启ssh服务 

service ssh restart 

2、更新sources.list,然后 apt-get update 

vim /etc/apt/sources.list
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse 
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse 
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse 
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse 
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse 
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse 
deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse 
deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse 
deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse 
deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse 
deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse 
deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse 
apt-get update 

3、通过 locale -a ,检查中文包问题,( 具体参考:英文Ubuntu安装中文包(locale)的方法;),然后,在/root/.profile 中增加:  export LC_ALL=zh_CN.UTF-8( 具体参考:   调整更改ubuntu时区,时间,locale )。

vim /root/.profile
export LC_ALL=zh_CN.UTF-8

输入以下命令安装:

cd /usr/share/locales 
sudo ./install-language-pack zh_CN 

然后重开终端,就可以发现中文locale已经安装完毕,警告已经不再出现了。 

当然,还可以执行: 

sudo locale-gen 

重建locale。

 

Ubuntu 内存问题:调整参数:/etc/sysctl.conf 【针对4G内存进行配置,老柏优化】 

vim /etc/sysctl.conf 
vm.lowmem_reserve_ratio = 256 32 32 
vm.min_free_kbytes = 307200 

4、安装相关软件 
安装openjdk 

sudo apt-get install openjdk-7-jdk       

安装MySQL 

sudo apt-get install mysql-server       

安装libcv 

sudo apt-get install libcv2.4 

安装tomcat7 

sudo apt-get install tomcat7  tomcat7-admin

安装gcc 

apt-get  install  build-essential 

安装libstdc++5 

sudo apt-get install libstdc++5    

安装libxv-dev 

apt-get install libxv-dev    

安装libcurl (httpclient) 

 ./configure --prefix=/usr/local/curl    ;   make  ;   make install 

5、软件与环境参数配置 
环境变量:

vim /root/.profile 
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/opt/xdt/videocheck/libs/dh:/opt/xdt/videocheck/libs/hk 
export JAVA_OPTS="-server -Xms512m -Xmx1024m -XX:PermSize=600M -XX:MaxPermSize=600m" 

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/opt/xdt/videocheck/libs/dh:/opt/xdt/videocheck/libs/hk 
export LC_ALL=zh_CN.UTF-8 
export JAVA_OPTS="-server -Xms512m -Xmx1024m -XX:PermSize=600M -XX:MaxPermSize=600m" 

6、优化tomcat 
安装authbind工具: apt-get install authbind

 

修改tomcat配置文件:  /etc/default/tomcat7 
/etc/default/tomcat7,  修改:AUTHBIND=yes 

 

开放80端口:               
touch /etc/authbind/byport/80 
chmod 0755 /etc/authbind/byport/80 
chown tomcat7:tomcat7 /etc/authbind/byport/80 

 

7、MySQL数据库(存储过程与参数配置) 
开启MySQL Event统计功能: 
sudo vim /etc/mysql/my.cnf 
增加下面内容: 

-- 查看是否开启定时器 
SHOW VARIABLES LIKE ‘event_scheduler‘; 
-- 开启定时器 0:off 1:on 
SET GLOBAL event_scheduler = 1;  

event_scheduler = 1 
bind-address = 0.0.0.0 

[client] 
default-character-set=utf8 
 [mysqld] 
character_set_server=utf8 
[mysql] 
default-character-set=utf8 

GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘system‘ WITH GRANT OPTION; 
flush privileges; 

 

 

啦啦啦

Ubuntu 14.04服务器安装及软件配置