标签:
关闭selinux(万恶之源):
临时生效:setenforce 0
永久生效:修改/etc/selinux/config文件中设置SELINUX=disabled
配置网路:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
service network restart
关闭network manage
临时生效:service NetworkManager stop
永久生效: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
使用eth1:
cat /etc/udev/rules.d/70-persistent-net.rules 记录eth1的mac地址
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
将 DEVICE="eth0" 改成 DEVICE="eth1" ,
将 HWADDR="00:0c:29:8f:89:97" 改成上面的mac地址 HWADDR="00:0c:29:50:bd:17"
# service network restart
优化ssh连接速度:
vi /etc/ssh/ssh_config 和 vi /etc/ssh/sshd_config ,设置GSSAPIAuthentication no ,UseDNS=no并重启:service sshd restart 或 etc/init.d/sshd restart
永久关闭防火墙:
chkconfig iptables off
设置时区:
1设置Centos时区:tzselect 然后依次输入 5 回车 9 回车 1 回车 1回车
2替换系统时区文件:cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
3date查看
安装java:
yum install java...
安装mysql:
yum install mysql
yum install mysql-server
yum install mysql-devel
//启动
service mysqld start
//开启自启动
chkconfig --add mysqld
chkconfig mysqld on
chkconfig --list
//设置root密码
mysqladmin -u root password root
//连接
mysql -uroot -proot
//允许远程访问
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘root‘ WITH GRANT OPTION;
配置:
[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这个ip,原因未知.
# 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 #超过30天的binlog删除
[mysqld_safe]
log-error=/var/lib/mysql/mysqld.log
pid-file=/var/lib/mysql/mysqld.pid
安装定时任务crontab:
yum -y install vixie-cron
yum -y install crontabs
service crond start
crontab -l
crontab -e
配置:
0 3 * * * /data/backup/database/db_to_file.sh
安装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
配置:
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 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
标签:
原文地址:http://www.cnblogs.com/zhenxi/p/4829174.html