腾讯云初始化

  1. 硬盘初始化

http://www.qcloud.com/wiki/Linux系统格式化小于2TB数据盘操作指引

fdisk -l,查看数据盘信息,包括未分区硬盘
fdisk /dev/vdb
依次输入“n”(新建分区)、“p”(新建扩展分区)、“1”(使用第1个主分区),两次回车(使用默认配置),输入“w”(保存分区表),开始分区。

mkfs.ext3 /dev/vdb1
返回根目录
mkdir /mydata
mount /dev/vdb1 /mydata
echo '/dev/vdb1 /mydata ext3 defaults 0 0' >> /etc/fstab

df -h
说明:重装系统后,无需再重新分区,直接进入格式化,mkfs.ext3 /dev/vdb1

  1. 安全加固
    http://bbs.qcloud.com/forum.php?mod=viewthread&tid=4480

wget http://mirrors.tencentyun.com/install/sec/vpcagent-X64.zip
unzip vpcagent-X64.zip
sh install64.sh

检查:/usr/local/sa/agent/check.sh

  1. yum 源
    mv /etc/yum.repos.d/base.repo /etc/yum.repos.d/base.repo.backup
    wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
    yum clean all
    yum makecache

yum updatcd

http://mirrors.163.com/.help/centos.html

  1. MySQL

检查,rpm -qa | grep -i mysql
强制卸载 默认的mysql 5.1, rpm -e --nodeps mysql-libs-5.1.*,
http://zfy421.iteye.com/blog/1960247

卸载 mariadb
rpm -e —nodeps
http://www.jb51.net/article/72397.htm

yum install glibc

wget http://mirrors.sohu.com/mysql/MySQL-5.5/MySQL-server-5.5.46-1.linux2.6.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-5.5/MySQL-client-5.5.46-1.linux2.6.x86_64.rpm
wget http://mirrors.sohu.com/mysql/MySQL-5.5/MySQL-devel-5.5.46-1.linux2.6.x86_64.rpm

rpm -ivh MySQL-server-5.5.46-1.linux2.6.x86_64.rpm

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf,改名为my.cnf作为mysql配置文件。

http://www.myexception.cn/operating-system/629986.html

更改mysql 目录到 数据盘
mv /var/lib/mysql /mydata/mysql/data/
chown -R mysql:mysql /mydata/mysql/data/
chmod -R 755 /mydata/mysql/data/
chmod -R 755 /mydata/mysql/data/mysql
chmod -R 755 /mydata/mysql/data/test
chmod -R 755 /mydata/mysql/data/performance_

修改 /etc/my.cnf,/etc/init.d/mysql, /usr/bin/mysqld_safe

[client]
default-character-set=utf8
socket=/mydata/mysql/data/mysql.sock

[mysqld]
port=3306
socket=/mydata/mysql/data/mysql.sock
character_set_server=utf8
max_allowed_packet = 16M

socket  = /var/lib/mysql/mysql.sock
datadir=/var/lib/mysql

ln -s /home/data/mysql/mysql.sock /var/lib/mysql/mysql.sock

grant all privileges ON . TO 'root'@'%' IDENTIFIED BY 'a123456' WITH GRANT OPTION;

字符集
SHOW VARIABLES LIKE ‘character%’;

默认编码:a123456

代理配置

wget http://www.boutell.com/rinetd/http/rinetd.tar.gz

vi /etc/rc.d/rc.local
/usr/sbin/rinetd -c /etc/rinetd.conf

端口转发:rinetd,http://www.boutell.com/rinetd/
配置:http://blog.sina.com.cn/s/blog_695d0b300101bdan.html
rinetd -c /etc/rinetd.conf

安装:
mkdir /usr/man/man8
http://www.linuxidc.com/Linux/2013-01/77794.htm

配置文件:
vi /etc/rinetd.conf

需要确认进程中没有rinetd,如果有的话,需要删除该进程:pkill rinetd
ps ax|grep rinetd

java

rpm -ivh jdk-7u79-linux-x64.rpm

vi /etc/profile

export JAVA_HOME=/usr/java/jdk1.7.0_79
export JRE_HOME=/usr/java/jdk1.7.0_79/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

echo "export JAVA_HOME=/usr/java/jdk1.7.0_79" >> /etc/bashrc
echo "export JRE_HOME=/usr/java/jdk1.7.0_79/jre" >> /etc/bashrc
echo "export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin" >> /etc/bashrc
echo "export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib" >> /etc/bashrc

ant

tar zxvf ant.tar.gz
echo "export PATH=$PATH:/opt/ant/bin" >> /etc/bashrc
echo "export ANT_HOME=/opt/ant" >> /etc/bashrc
source /etc/bashrc

tomcat

你可能感兴趣的:(腾讯云初始化)