CentOS 6.8_x64 Linux下基础环境搭建

前端之家收集整理的这篇文章主要介绍了CentOS 6.8_x64 Linux下基础环境搭建前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

0x01 纪录Linux用户操作日志

root下将如下语句追加到 # vi /etc/profile文件中,然后 # source /etc/profile使配置生效。

USER_IP=`who am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
USER=`whoami`
export PROMPT_COMMAND="history -a"
if [ "$USER_IP" = "" ]; then
    USER_IP=$HOSTNAME
fi
if [ ! -d /tmp/.bash_history/$USER/ ]; then
    mkdir -p /tmp/.bash_history/$USER/
fi
export HISTSIZE=4096
export HISTTIMEFORMAT="%Y-%m-%d_%H:%M:%S "
DT=`date +%Y%m%d`
export HISTFILE="/tmp/.bash_history/$USER/${DT}_$USER_IP.log"
chattr +a /tmp/.bash_history/$USER/$DT_$USER_IP.log 2>/dev/null

0x02 MysqL-5.7

# rpm -ivh https://raw.githubusercontent.com/jsbd/learn/master/MysqL/MysqL57-community-release-el6-8.noarch.rpm
# yum repolist enabled |grep MysqL
# yum -y install MysqL-community-server
# service MysqLd start
# service MysqLd status
# grep 'temporary password' /var/log/MysqLd.log
# MysqL -uroot -p 
# MysqL> use MysqL;
# MysqL> ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourNewPass!@3306';
# MysqL> FLUSH PRIVILEGES;

# 新建普通用户
# MysqL> use MysqL;
# MysqL> create user biz_offline IDENTIFIED by 'bizPass4Db@';
# MysqL> show grants for biz_offline;
# MysqL> grant all on *.* to biz_offline@’%’;
# MysqL> FLUSH PRIVILEGES;

# 设置开机启动
# chkconfig MysqLd on

0x03 Java1.8

# yum -y list java*
# yum -y install java-1.8.0-openjdk*
# java -version
openjdk version "1.8.0_101"
OpenJDK Runtime Environment (build 1.8.0_101-b13)
OpenJDK 64-Bit Server VM (build 25.101-b13,mixed mode)

0x04 Ant

# yum -y install ant
# ant -version
Apache Ant version 1.7.1 compiled on May 10 2016

0x05 Memcached

# yum search memcached
# yum -y install memcached

# 查看memcached配置文件
# cat /etc/sysconfig/memcached

# 设置开机启动memcached
# chkconfig memcached on
# service memcached start

0x06 Redis

# yum -y install epel-release
# yum -y install redis

# Redis配置文件
# cat /etc/redis.conf

# 设置开机启动redis
# chkconfig redis on
# service redis start

0x07 Haproxy

# yum -y install haproxy

#haproxy配置文件
# cat /etc/haproxy/haproxy.cfg

# 设置开机启动haproxy
# chkconfig haproxy on
# service haproxy start

0x08 Apache

# yum -y install httpd

# 设置开机启动apache
# chkconfig httpd on
# service httpd start

# apache配置文件
# cat /etc/httpd/conf/httpd.conf

0x09 Nginx

# 方法一:手工添加
# vi /etc/yum.repos.d/Nginx.repo
[Nginx]
name=Nginx repo
baseurl=http://Nginx.org/packages/mainline/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

“OS”替换成rhel 或者 centos
“OSRELEASE”替换成对应的版本号5代表5.x,6代表 6.x,7代表7.x系列的操作系统
“/mainline” 代表获取最新的主线版本(不是稳定版本)。如果获取最新的稳定版本则将/mainline直接删除掉即可。

# 方法二:直接rpm安装官方提供的Nginx
# rpm -ivh https://raw.githubusercontent.com/jsbd/learn/master/Nginx/Nginx-release-centos-6-0.el6.ngx.noarch.rpm
# yum -y install Nginx

# Nginx配置文件
# cat /etc/Nginx/Nginx.conf

# 设置开机启动Nginx
# chkconfig Nginx on
# service Nginx start

0x0A 其他配置

猜你在找的CentOS相关文章