CentOS 大米云服务器服务器搭建笔记

前端之家收集整理的这篇文章主要介绍了CentOS 大米云服务器服务器搭建笔记前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
cat /etc/redhat-release

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


yum -y update

yum -y install make gcc-c++ cmake bison-devel ncurses-devel libaio libaio-devel perl-Data-Dumper net-tools
yum -y install wget
wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
tar xzvf boost_1_59_0.tar.gz
cd boost_1_59_0
./bootstrap.sh --with-libraries=system,filesystem,log,thread --with-toolset=gcc
./b2 toolset=gcc cxxflags="-std=c++11"
./b2 install
wget http://dev.MysqL.com/get/Downloads/MysqL-5.7/MysqL-5.7.12.tar.gz
md5sum MysqL-5.7.12.tar.gz
tar xvf MysqL-5.7.12.tar.gz
cd MysqL-5.7.12
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/MysqL \
-DMysqL_DATADIR=/usr/local/MysqL/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMysqL_UNIX_ADDR=/var/lib/MysqL/MysqL.sock \
-DMysqL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make && make install

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]

default-character-set=utf8

注释掉

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 添加

-AINPUT-mstate--stateNEW-mtcp-ptcp--dport6379-jACCEPT

-A INPUT -m state --state NEW -m tcp -p -dport 3306 -j ACCEPT

serviceiptablesrestart

cdusr/local/redis/bin

viredis.conf

添加

port6379

bind192.168.19.131

./redis-serverredis.conf

wgethttp://zlib.net/zlib-1.2.8.tar.gz

tarxzfzlib-1.2.8.tar.gz

cdzlib-1.2.8

./configure --shared

maketest

makeinstall

cpzutil.h/usr/local/include

cpzutil.c/usr/local/include

cd ../

wgethttp://www.atoptool.nl/download/atop-2.2-3.tar.gz

tarxvfatop-2.2-3.tar.gz

cdatop-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

wgethttp://download.redis.io/releases/redis-3.2.0.tar.gz

tarxzfredis-3.2.0.tar.gz

cdredis-3.2.0

cdsrc

makePREFIX=/usr/local/redisinstall

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

chmod755/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

wgethttps://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

原文链接:https://www.f2er.com/centos/379621.html

猜你在找的CentOS相关文章