CentOS7 minimize installation configuration

Brief

  • Minimize version Installation CentOS 7: CentOS-7-x86_64-Minimal-1708

Basic Configuration

Network Configuration

  • VM selection bridge
  • Manually configure the network address
  • Verify that you can access the Internet

VM cloning system set static IP


cd /etc/sysconfig/network-scripts/

vi ifcfg-eno16777736

Comment out the UUID, HWADDR


TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16777736"
#UUID="10f47dcb-cc95-4aad-a56c-36fe7920f431"
ONBOOT="yes"
IPADDR0="192.168.199.200"
PREFIX0="24"
GATEWAY0="192.168.199.1"
DNS1="8.8.8.8"
DNS2="9.9.9.9"
#HWADDR="00:0C:29:E3:95:59"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"

Network Service Restart

service network restart

Modify the hostname

hostnamectl set-hostname serverHostName 

Time synchronization system configuration


yum install ntpdate

# 同步时间服务器
ntpdate time.nist.gov
# 或
ntpdate -u 0.pool.ntp.org

Synchronization time may be a problem, see solving CentOS7 next time synchronization problem with ntpdate

Installation of basic tools

Install net-tools

yum -y install net-tools 

Install wget

yum -y install wget

Installation curl

yum -y install curl

Basic Commands

Finding the installation path:

whereis nginx

Find the file path:

find / -name nginx

Nginx query process:

ps aux|grep nginx

View CentOS kernel version:

uname -r

View gcc is installed

rpm -qa|grep gcc

Uninstall software

Need to see your package formats:


# 如果你带有yum,可以直接
yum remove xxx

# 如果是rpm包,
rpm -e xxx

# tar包的话需要你直接删除该文件或者
make uninstall xxx

Uninstall Docker:



# 查看
yum list installed | grep docker

# 卸载
yum -y remove docker.xxx.x86_64

# 删除
rm -ef /var/lib/docker
#查看ip信息
ip add

#显示当前路径的全路径 
pwd

#文件复制 
cp -r /bashrc /bak/bashrc

#更新
yum update

tail -f /data/logs/xxxx/xxxx.log

#查看文档内容
cat

#分页查看文档内容
more

#列出所有文件
ls -a

#拷贝文件夹及文件夹内文件
cp -r tomcat-xxxx tomcat-xxxx-new

#强制删除文件夹或文件
rm -rf logs

#清空文件内容
echo "">catalina.out


# 找到 tomcat-x-cas-server 的进程,
# 第二个参数是 pid
# 通过 pid 杀死进程
ps -ef | grep "tomcat-x-cas-server" | grep -v grep | awk '{print $2}' | xargs kill -9

Development environment

Install java

1. Uninstall comes openjdk

rpm -qa|grep java

rpm -e --nodeps java-xxx

2. Download from the official website of Oracle jdk-8u181-linux-x64.tar.gz

3. Extract

tar –xzvf jdk-8u45-linux-x64.gz

4.jdk configuration

vi /etc/profile
export JAVA_HOME=jdk的绝对路径
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Use source /etc/profilereload the configuration, the configuration.

or

Use rebootthe command to restart the system environment variables to take effect.

5. Test whether the installation is successful

java -version

javac

Installing Maven

yum -y install maven

Install Git

yum -y install git

Tomcat installation

# 通过 wget 方式下载 apache-tomcat-8.5.23.tar.gz
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.23/bin/apache-tomcat-8.5.23.tar.gz

# 解压 apache-tomcat-8.5.23.tar.gz
tar -xzvf apache-tomcat-8.5.23.tar.gz

# 启动 tomcat 
./startup.sh

# 将8080端口添加到防火墙例外并重启
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload

Installing MySQL

#1. 下载 mysql 的 repo 源
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
#2. 安装 mysql 的 repo 源
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
#3. 安装 mysql
yum -y install mysql-server

After Mysql5.7 is installed by default root password.

Get MySQL temporary password
in order to strengthen security, MySQL5.7 randomly generate a password for the root user, the error log, with regard to the location of the error log, if the installation of RPM packages, the default is / var / log / mysqld. log.
Mysql only start once the temporary password before they can view

#查看原始密码
grep 'temporary password' /var/log/mysqld.log

#将3306端口添加到防火墙例外并重启
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

#修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'eFeG20125';

#授权远程网络访问
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.199.%' IDENTIFIED BY 'eFeG20125' WITH GRANT OPTION;
flush privileges;

MySQL 5.7.25 https://blog.csdn.net/qq_30162219/article/details/87768612

Installation Redis

#1. 设置 Redis 的仓库地址
yum -y install epel-release
#2. 安装 Redis
yum -y install redis
#3. redis 相关目录及文件
rpm -ql redis

[root[@galsang](https://my.oschina.net/u/3537623) ~]# rpm -ql redis
/etc/logrotate.d/redis
/etc/redis-sentinel.conf
/etc/redis.conf
/etc/systemd/system/redis-sentinel.service.d
/etc/systemd/system/redis-sentinel.service.d/limit.conf
/etc/systemd/system/redis.service.d
/etc/systemd/system/redis.service.d/limit.conf
/usr/bin/redis-benchmark
/usr/bin/redis-check-aof
/usr/bin/redis-check-rdb
/usr/bin/redis-cli
/usr/bin/redis-sentinel
/usr/bin/redis-server
/usr/lib/systemd/system/redis-sentinel.service
/usr/lib/systemd/system/redis.service
/usr/libexec/redis-shutdown
/usr/share/doc/redis-3.2.12
/usr/share/doc/redis-3.2.12/00-RELEASENOTES
/usr/share/doc/redis-3.2.12/BUGS
/usr/share/doc/redis-3.2.12/CONTRIBUTING
/usr/share/doc/redis-3.2.12/MANIFESTO
/usr/share/doc/redis-3.2.12/README.md
/usr/share/licenses/redis-3.2.12
/usr/share/licenses/redis-3.2.12/COPYING
/usr/share/man/man1/redis-benchmark.1.gz
/usr/share/man/man1/redis-check-aof.1.gz
/usr/share/man/man1/redis-check-rdb.1.gz
/usr/share/man/man1/redis-cli.1.gz
/usr/share/man/man1/redis-sentinel.1.gz
/usr/share/man/man1/redis-server.1.gz
/usr/share/man/man5/redis-sentinel.conf.5.gz
/usr/share/man/man5/redis.conf.5.gz
/var/lib/redis
/var/log/redis
/var/run/redis

Meaning of the various parameters

  1. Configuration redis.conf

    etc / redis.conf

#bind 127.0.0.1 
requirepass redisPassword
  1. Redis open port

    Adding exceptions to the firewall port 6379 and restart

firewall-cmd --zone=public --add-port=6379/tcp --permanent
firewall-cmd --reload

6. Start

Start mode
client connections

Install Nginx


yum -y install nginx

/usr/sbin/nginx -s reload

# 重启 nginx 服务
service nginx restart

# 将 80 端口添加到防火墙例外并重启
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

RabbitMQ installation

RabbitMQ installed on CentOS7

Configuring swap swap


# 确定硬盘的最佳块大小:

dd if=/dev/zero bs=1024 count=1000000 of=/root/1Gb.file

dd if=/dev/zero bs=2048 count=500000 of=/root/1Gb.file

dd if=/dev/zero bs=4096 count=250000 of=/root/1Gb.file

dd if=/dev/zero bs=8192 count=125000 of=/root/1Gb.file

# 通过比较以上命令输出中所显示的命令执行时间,即可确定系统最佳的块大小。

free -m
df -h
cd /var
dd if=/dev/zero of=swapfile bs=1024 count=4096
#dd if=/dev/zero of=swapfile bs=4M count=2048

/sbin/mkswap swapfile
ll swapfile 
/sbin/swapon swapfile
/sbin/swapon -s

vim /etc/fstab
/var/swapfile swap swap defaults 0 0

#停止所有的swap分区
swapoff -a 

Guess you like

Origin www.cnblogs.com/ljmatlight/p/10986051.html