Turn off SELinux (the source of all evils):
Temporary entry into force: Setenforce 0
Permanent entry: Modify the settings in the/etc/selinux/config file selinux=disabled
Configure the network:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Service Network restart
Close Network Manage
Temporary entry into force: Service NetworkManager Stop
Permanent entry: Chkconfig NetworkManager off
Device= "Eth0"
Bootproto=static #静态分配ip
ipaddr=192.168.1.201 #ip
gateway=192.168.1.1 #网关
netmask=255.255.255.0 #子网掩码
Hwaddr= "00:0c:29:79:f5:af"
Ipv6init= "No"
Nm_controlled= "Yes"
onboot= "Yes"
Type= "Ethernet"
Uuid= "493298e6-6dc4-4e70-a0e3-05d24a31c53f"
dns1=192.168.1.1 #主dns
Using eth1:
Cat/etc/udev/rules.d/70-persistent-net.rules record the MAC address of the ETH1
# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Change device= "eth0" to Device= "eth1",
Change the hwaddr= "00:0c:29:8f:89:97" to the MAC address above hwaddr= "00:0c:29:50:bd:17"
# Service Network Restart
Optimize SSH connection speed:
Vi/etc/ssh/ssh_config and Vi/etc/ssh/sshd_config, setting Gssapiauthentication No, usedns=no and restarting: Service sshd restart or etc/init . d/sshd Restart
To permanently shut down the firewall:
Chkconfig iptables off
Set the time zone:
1 Set the CentOS time zone: Tzselect then enter 5 return car 9 return car 1 return car 1 return car
2 Replacing the system time zone file: Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
3date View
Install Java:
Yum Install Java ...
Install MySQL:
Yum install MySQL
Yum Install Mysql-server
Yum Install Mysql-devel
Start
Service mysqld Start
Turn on self-booting
Chkconfig--add mysqld
Chkconfig mysqld on
Chkconfig--list
Set Root password
mysqladmin-u Root Password root
Connection
Mysql-uroot-proot
Allow remote access
GRANT all privileges on * * to ' root ' @ '% ' identified by ' root ' with GRANT OPTION;
Configuration:
[Mysqld]
Datadir=/data/mysql
Socket=/data/mysql/mysql.sock
User=mysql
Default-character-set=utf8
max_connections=500
Skip-name-resolve #建立连接时不进行DNS解析
Skip-grant-tables #不设置这个会到只无法解析127.0.0.1 This IP, the reason is unknown.
# Master-slave
server_id = 1
#relay_log =/var/lib/mysql/mysql-relay-bin #从库中继日志位置
#log_slave_updates = 1 #从库根据中继日志重现时是否产生binlog
#read_only = 1 #从库的权限控制优化
# Binlog
Log_bin = Mysql-bin #二进制log文件名前缀
Expire_logs_days = #超过30天的binlog删除
[Mysqld_safe]
Log-error=/var/lib/mysql/mysqld.log
Pid-file=/var/lib/mysql/mysqld.pid
To install a scheduled task crontab:
Yum-y Install Vixie-cron
Yum-y Install Crontabs
Service Crond Start
Crontab-l
Crontab-e
Configuration:
0 3 * * */data/backup/database/db_to_file.sh
Install Nginx:
RPM-IVH http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
Yum Install Nginx
Service Nginx Start
Configuration:
User Nginx;
Worker_processes 1;
Error_log/var/log/nginx/error.log warn;
Pid/var/run/nginx.pid;
Events {
Worker_connections 1024;
}
HTTP {
Include/etc/nginx/mime.types;
Default_type Application/octet-stream;
Log_format Main ' $remote _addr-$remote _user [$time _local] "$request" '
' $status $body _bytes_sent ' $http _referer '
' "$http _user_agent" "$http _x_forwarded_for";
Access_log/var/log/nginx/access.log main;
Sendfile on;
#tcp_nopush on;
Keepalive_timeout 65;
#gzip on;
#include/etc/nginx/conf.d/*.conf;
server {
Listen 80;
server_name localhost;
Location/{
Root/data/nginx;
Index index.html index.htm;
AutoIndex on;
Client_body_temp_path client_temp;
Dav_methods PUT DELETE mkcol COPY MOVE;
Create_full_put_path on;
Dav_access ALL:RW;
}
Error_page 502 503 504/50x.html;
Location =/50x.html {
root/usr/share/nginx/html;
}
}
}
SSS new Linux Complete configuration introduction