fdisk -l
mkfs.ext4 /dev/vdb
mkdir -p /data
mount /dev/vdb /data
df -h
vi /etc/fstabs
/dev/vdb /data ext4 defaults 0 0
groupadd mysql
useradd -g mysql mysql
chown -R mysql:mysql /usr/local/mysql
cd /usr/local/mysql
cp support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
chkconfig --list mysql
chkconfig --add mysql
chkconfig --level 345 mysql on
mv /etc/my.cnf /etc/my.cnf.bak
sudo cp support-files/my-default.cnf /etc/my.cnf
sudo vi /etc/my.cnf
修改配置:
[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
#datadir = /usr/local/mysql/data
[client]
注释掉
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
vi /etc/profile +
环境变量:
# mysql
export PATH=/usr/local/mysql/bin:$PATH
# mongodb
export PATH=/usr/local/mongodb/bin:$PATH
# memcached
export PATH=/usr/local/memcached/bin:$PATH
# redis
export PATH=/usr/local/redis/bin:$PATH
# hadoop
export PATH=/usr/local/hadoop/bin:$PATH
source /etc/profile
vi /root/.mysql_secret
bin/mysqladmin -uroot -p password root
输入旧密码:上述记录的密码e9DE0jqlpLR)
mysql -uroot -proot
\q
yum install iptables-services
systemctl mask firewalld.service systemctl enable iptables.service systemctl enable ip6tables.service
systemctl stop firewalld.service systemctl start iptables.service systemctl start ip6tables.service
vi /etc/sysconfig/iptables 添加:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p -dport 3306 -j ACCEPT
service iptables restart
cd usr/local/redis/bin
vi redis.conf
添加:
port 6379
bind 192.168.19.131
./redis-server redis.conf
wget http://zlib.net/zlib-1.2.8.tar.gz
tar xzf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --shared
make test
make install
cp zutil.h /usr/local/include
cp zutil.c /usr/local/include
cd ../
wget http://www.atoptool.nl/download/atop-2.2-3.tar.gz
tar xvf atop-2.2-3.tar.gz
cd atop-2.2-3
make systemdinstall prefix=/usr/local/atop install
atop
q
sudo vi /etc/rc.local +
# mongodb
/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb.conf
source /etc/rc.local
wget http://download.redis.io/releases/redis-3.2.0.tar.gz
tar xzf redis-3.2.0.tar.gz
cd redis-3.2.0
cd src
make PREFIX=/usr/local/redis install
cd /usr/local/redis
bin/redis-server
cp ~/download/redis-3.2.0/redis.conf /usr/local/redis/bin
cd /usr/local/redis/bin
vi redis.conf
bind ip地址
pidfile /usr/local/redis/bin/redis_6379.pid
cd /data
mkdir redis
mkdir mysql
mkdir mongodb
chmod 755 redis
chmod 755 mysql
chmod 755 mongodb
cd redis
mkdir data
mkdir log
chmod 755 data
chmod 755 log
cd mysql
mkdir data
mkdir log
chmod 755 data
chmod 755 log
cd mongodb
mkdir data
mkdir log
chmod 755 data
chmod 755 log
cp ~/download/redis-3.2.0/utils/redis_init_script /etc/init.d/redis
chmod 755 /etc/init.d/redis
vi /etc/init.d/redis
修改为:
#!/bin/sh
# chkconfig: 2345 10 90
# description: Start and Stop redis
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
CLIEXEC=/usr/local/redis/bin/redis-cli
PIDFILE=/usr/local/redis/bin/redis_${REDISPORT}.pid
CONF="/usr/local/redis/bin/redis_${REDISPORT}.conf"
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF &
fi
;;
status)
if [ -f $PIDFILE ]
then
echo "SUCCESS! Redis is Running(Port:${REDISPORT} PID:$(cat $PIDFILE))"
else
echo "ERROR! Redis is not Running"
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -h 120.92.51.207 -p $REDISPORT SHUTDOWN
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi
;;
restart)
${0} stop
${0} start
;;
*)
echo "Please use start or stop as first argument"
;;
esac
chmod +x /etc/init.d/redis
chkconfig redis on
service redis start
cp redis.conf redis_6379.conf
service redis start
wget http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz?AuthParam=1480663369_63c1ac505b618f911ba76330896fc5b3
mv jdk-8u112-linux-x64.tar.gz?AuthParam=1480663369_63c1ac505b618f911ba76330896fc5b3 jdk-8u112-linux-x64.tar.gz
mkdir /usr/lib/jdk
mv ~/download/jdk1.8.0_112 /usr/lib/jdk
# jdk
export JAVA_HOME=/usr/lib/jdk/jdk1.8.0_112
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:$JRE_HOME/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=${JAVA_HOME}/bin:$PATH
source ~/.bashrc
java -version
yum install -y openssl-devel openssl
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.2.6.tgz
tar xvf mongodb-linux-x86_64-rhel70-3.2.6.tgz
mv ~/download/mongodb-linux-x86_64-rhel70-3.2.6 /usr/local/mongodb
cd /usr/local/mongodb/bin
vi mongodb_27017.conf
配置文件:
datapath=/data/mongodb/data
logpath=/data/mongodb/log/mongodb.log
port=27017
bind_ip=120.92.51.207
fork=true
nohttpinterface=true
vi /etc/rc.local
添加配置:
# mongodb
/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb_27017.conf
source /etc/rc.local
wget http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-2.7.2/hadoop-2.7.2.tar.gz
tar xzvf hadoop-2.7.2.tar.gz
mv ~/download/hadoop-2.7.2 /usr/local/hadoop
hadoop version
防止暴力破解方式:
1.更改密码复杂度,
2.更改远程端口,
3.最好控制台安全组指定IP允许远程登陆。
修改远端登录端口:
把没有绑定云服务器的配置都可以删除,在绑定的云服务器下增加TCP, 自动定义一个端口(范围0~65535);
增加以后 连接实例 或者直接远端用22端口连接
进入系统;
vi /etc/ssh/sshd_config
增加
Port 507
然后执行:
service sshd restart
netstat -an | grep 507
检测远端端口监听是否开启,如果有内容就打开了。
然后自定义端口可以远端登录了