1.配置靜態地址
vim /etc/network/interfaces
auto enp1s0
iface enp1s0 inet static
address 192.168.1.131
netmask 255.255.255.0auto enp2s0
iface enp2s0 inet static
address 192.168.2.131
netmask 255.255.255.0auto enp3s0
iface enp3s0 inet static
address 192.168.10.131
netmask 255.255.255.0
gateway 192.168.10.1auto enp4s0
iface enp4s0 inet static
address 172.123.123.123
netmask 255.255.255.0
2.配置DNS地址
vim /etc/resolvconf/resolv.conf.d/tail
nameserver 192.168.10.1
3.開啟root遠程登錄權限?
sudo vi /etc/ssh/sshd_config
將PermitRootLogin?without-password?修改為PermitRootLogin?yes?
4.重啟ssh服務?
service ssh restart
5、更新sources.list???,然后?apt-get?update?
vim /etc/apt/sources.list
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb http://archive.canonical.com/ubuntu xenial partner deb-src http://archive.canonical.com/ubuntu xenial partner deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
apt-get update
6、通過?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。?
7.Ubuntu?內存問題:調整參數:/etc/sysctl.conf?【針對4G內存進行配置】?
vim /etc/sysctl.conf
vm.lowmem_reserve_ratio = 256 32 32
vm.min_free_kbytes = 307200
8、安裝相關軟件?
dpkg -l | grep %openjdkXXX%
service tomcat7 status
ESC : q
service tomcat7 stop?
service tomcat7 start
service tomcat7 restart
?
安裝openjdk?
sudo apt-get install openjdk-8-jdk
安裝MySQL?
apt-get install mysql-server
安裝libcv?
apt-get install libcv2.4
安裝tomcat8?
apt-get install tomcat8 tomcat8-admin
安裝gcc?
apt-get install build-essential
安裝libstdc++5?
apt-get install libstdc++5
安裝libxv-dev?
apt-get install libxv-dev
9、軟件與環境參數配置?
環境變量:
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"
?
?10、優化tomcat?
安裝authbind工具:? ??
apt-get install authbind
修改tomcat配置文件:?
vim /etc/default/tomcat8
/etc/default/tomcat8,??修改:AUTHBIND=yes?
開放80端口:???????????????
touch /etc/authbind/byport/80
chmod 0755 /etc/authbind/byport/80
chown tomcat8:tomcat8 /etc/authbind/byport/80
11、MySQL數據庫(存儲過程與參數配置)?
vim /etc/mysql/conf.d/mysql.cnf
[mysql]
default-character-set=utf8
vim /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld] character_set_server=utf8
#bind-address = 127.0.0.1
show variables like '%char%';
開啟MySQL?Event統計功能:?
--?查看是否開啟定時器?
SHOW?VARIABLES?LIKE?'event_scheduler';?
--?開啟定時器?0:off?1:on?
SET?GLOBAL?event_scheduler?=?1; ?
?
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'system' WITH GRANT OPTION;
?
flush privileges;
?
select host from user where user = 'root';