Linux Centos7 deployment environment installation -CentOS

Linux Centos7 deployment environment installation -CentOS

Centos7 installation and deployment environment Linux common commands

  • The role of each folder under centos system
  • centos7 modify the system default language
  • centos7 mounting rz / sz command
  • centos7 installation netstat
  • centos7 install lsof command
  • centos7 download and install and configure the environment variables jdk
  • centos7 install Tomcat
  • centos7 install Nginx
  • centos7 install MySQL
  • Linux common commands

The role of each folder under centos system

  • /: Root directory, in general, only the root storage directory, do not store the file, / etc, / bin, / dev, / lib, / sbin should be placed in the root directory of a partition
  • / Bin: / usr / bin: executable binary files directory, commonly used commands such as ls, tar, mv, cat and so on.
  • / Boot: put some files used when starting linux system.
    • / Boot / vmlinuz for the linux kernel file, and / boot / gurb. It recommended a separate partition, partition size to 100M
  • / Dev: file storage device linux system, access a file in the directory, which is equivalent to access a device commonly used to mount the CD mount / dev / cdrom / mnt.
  • / Etc: system configuration files directory is not recommended to store executable files in this directory, it is important configuration files have /etc/inittab,/etc/fstab,/etc/init.d,/etc/X11,/etc remember before the backup /sysconfig,/etc/xinetd.d modify the configuration file. Note: / etc / X11 store associated with the x windows settings.
  • / Home: the default user's home directory, create a new user account, the user's home directory are stored in this directory, ~ represents the current user's home directory, ~ test represents the home directory of the user test. It recommended a separate partition, and a larger set of disk space to store user data
  • /lib:/usr/lib:
    • Need help library when the library catalog system, the program in the implementation process, you need to call some additional parameters, the more important directory / lib / modules: / usr / local / lib.
  • / Lost + fount: the system generates an error exception, will lose some of this fragment is placed under the directory, usually this directory will automatically appear in the directory means. The load in the hard disk / disk in this directory will be automatically generated directory / disk / lost + found
  • / Mnt: / media: mount point default optical disc, the optical disc is usually mounted at / mnt / cdrom, not necessarily, be mounted at any position can be selected.
  • / Opt: to host an additional install the software place the directory. Such as: Fedora community development software FC4 use, if you want to install their own new KDE desktop software, you can install the software in the directory. Previous Linux system, used to be placed in the / usr / local directory
  • / Proc: The data in this catalog are in memory, such as system core, peripherals, network status, since the data are stored in memory, so do not take up disk space, the more important directories have / proc / cpuinfo, / proc / interrupts , / proc / dma, / proc / ioports, / proc / net / * etc.
  • / Root: system administrator root's home directory, the system first boot partition for /, so it is best to / root and / placed under a partition.
  • / Sbin: / usr / sbin: / usr / local / sbin: placing executable commands used by the system administrator, such as fdisk, shutdown, mount the like. And / bin difference is that these directories are commands to the system administrator root to use, the average user can only "see" and can not set up and use.
  • / Tmp: general user or program being executed temporary storage directory files, anyone can access the important data can not be placed in this directory
  • / Srv: the service started need to access the data directory, Web services need to access data such as www stored in srv / in the / www
  • / Usr: application storage directory,
    • / Usr / bin storage applications,
    • / Usr / share shared data store,
    • / Usr / lib store can not be run directly, but some library files necessary to run many programs.
    • / Usr / local: storage software upgrade package.
    • / Usr / share / doc: system description file storage directory.
    • / Usr / share / man: the program documentation storage directory, the query will use man ls content /usr/share/man/man1/ls.1.gz suggestions separate partition, set a large disk space
  • / Var: during the execution of placement systems frequently changing files, log files, such as to change the / var / log, / var / log / message: All of the log file storage directory, / var / spool / mail: e-mail stored in the directory, / var / run: start a program or service

linux Java developers frequently used commands

centos7 modify the system default language

Check whether the system has a Chinese language pack installation

locale -a |grep zh_CN

View the system default language

echo $LANG

Modify the system default language

/Etc/locale.conf modify files, modify LANG = zh_CN.UTF-8

centos7 install the Developer Tools

English system is installed: # yum -y groupinstall "Development tools "
Chinese system is installed: # yum -y groupinstall "development tools"

centos7 mounting rz / sz command

#######安装rz/sz命令#######
yum install -y lrzsz

#######解压/压缩.tar.gz#######
#解压
tar -xvzf apache-tomcat-8.5.23.tar.gz
#压缩
tar -zcvf 文件名.tar.gz 要压缩的文件/文件夹
# 例如:
tar -zcvf webfile.tar.gz webfile

centos7 installation netstat

yum install net-tools

centos7 install lsof command

yum install lsof

centos7 yum to download and install and configure the environment variables jdk

  1. Check if java installed:
yum list installed | grep java
  1. Uninstall java
yum -y remove java-1.8.0-openjdk*
  1. View a list of java package
yum -y list java*
  1. Download and install all the packages java1.8, midway need to enter y to confirm the download.
yum install java-1.8.0-openjdk*
  1. Check whether the installation was successful
java -version
  1. Configuration environment variable

java default installation yum / usr / lib / jvm, enter the directory can be seen java-1.8.0-openjdk-1.8.0.222.b10-1.el7_7.x86_64, the JAVA_HOME to that directory; is added at the bottom of the file

6.1 Current users:

# vi命令编辑~/.bashrc文件,按I进入编辑模式
vi ~/.bashrc

# 添加下面这行代码
export  JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-1.el7_7.x86_64

# 保存并退出
:wq

6.2 All users:


vi /etc/profile

#set java environment-------------start  

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-1.el7_7.x86_64

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar

export PATH=$PATH:$JAVA_HOME/bin

#set java environment-------------end

# 保存并退出

# 使配置生效
. /etc/profile
  1. Check the configuration environment variable, the installation was successful
# 查看配置的环境变量
echo $JAVA_HOME
# java安装是否成功

java -version

# jdk是否安装成功、如果出现说明文档,则安装成功
javac 

centos7 install Tomcat

Install jdk, tomcat upload the archive and unzip:

#### 启动tomcat
cd apache-tomcat-8.5.23/bin/
sh startup.sh

#### 查看启动日志
cd apache-tomcat-8.5.23/logs/
cat catalina.out

centos7 install Nginx

Download Nginx

wget http://nginx.org/download/nginx-1.14.0.tar.gz

Extract the installation package, and install the package into the directory

tar zxvf nginx-1.14.0.tar.gz
cd nginx-1.14.0

Compile and install

# 1.
./configure 
# 2.
make
# 3.
make install

View nginx version

 /usr/local/nginx/sbin/nginx -v

Command to check the correctness of the configuration file nginx.conf

/usr/local/nginx/sbin/nginx -t

Normal results are as follows:

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

nginx commonly used commands

#启动命令
/usr/local/nginx/sbin/nginx
#重新载入配置文件
/usr/local/nginx/sbin/nginx -s reload
#重启 Nginx
/usr/local/nginx/sbin/nginx -s reopen
#停止 Nginx
/usr/local/nginx/sbin/nginx -s stop
#监测Nginx服务是否正在运行
netstat -anput | grep nginx

Reference Documents

Nginx CentOS installed and tested under: https://blog.csdn.net/qq_35976320/article/details/80458079

How to configure nginx load balancing: https://www.cnblogs.com/yuuje/p/11005992.html

Installing MySQL

Under centos7 yum mounted mysql5.6

View available MySQL installation package

yum -y list mysql*

View the current list of installed mariadb

rpm -qa | grep mariadb

Uninstall

rpm -e --nodeps mariadb-5.5.64-1.el7.x86_64
rpm -e --nodeps mariadb-libs-5.5.64-1.el7.x86_64

Yum install the MySQL source

The above website to find a link, use wget installed:

wget 'https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm'

Yum install source

rpm -Uvh mysql57-community-release-el7-11.noarch.rpm

Check whether the installation was successful mysql source

yum repolist enabled | grep "mysql.*-community.*"

See which version of mysql are:

yum repolist all | grep mysql

mysql-devel: development libraries and include files used;
MySQL: MySQL client;
MySQL-Server: database server;

The default installation mysql5.7

yum install -y mysql-community-server

Start mysql

#centos7 命令 启动mysql
systemctl start mysqld
#查看状态
systemctl start mysqld

View mysql status -2,019,925,224,248

Log database, modify the database password

grep 'temporary password' /var/log/mysqld.log

mysql to change the password -2,019,925,224,433

Log database:

mysql -uroot -p

After entering your password Enter, enter mysql, execute the following command:

### 密码不要太简单,否则修改失败
SET PASSWORD = PASSWORD('Mysql520!');

mysql Change Password result -2,019,925,225,051

You can set up remote login

#第一步
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Mysql520!' WITH GRANT OPTION;
#第二步
flush privileges;

Modify the configuration file

vim /etc/my.cnf
Modify the database encoding

At the end the following new, modified encoded as utf8mb4

[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

Enter the SQL statement: show variables like 'char%';View character set;

Support group by sql statement
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Set the time zone to the East eight districts
default-time_zone = '+8:00'

Restart the database, validate the configuration

systemctl restart mysqld

Set boot

systemctl enable mysqld
systemctl daemon-reload

3306 cloud server ports open

If you can not connect when the connection test is successful, open port 3306 cloud server.

Reference Documents

centos7下使用yum源安装mysql5.7记录:[https://www.jianshu.com/p/531cc35b15e7](https://www.jianshu.com/p/531cc35b15e7)

Common Commands

# 查看ip地址
ip addr
# 查看占用端口的进程
netstat -lnp|grep 8080
#或
lsof -i:8080
# 根据进程ID查看进程的具体信息
ps axu|grep 2643 
# 列出所有端口
netstat -ntlp
# 查看进程
ps -ef|grep nginx


# 杀死进程
kill -9 进程号

killall -9 进程名字

## 删除文件或文件夹
# 删除目录
rm /home/test
# -r是递归的删除参数表中的目录及子目录
rm -r /home/test
# f是不提示用户,删除目录下的所有文件
rm -rf /home/test
# -i是交互模式
rm -ir /home/test

Starting blog address, click Access: https://www.wanglixia.top/
original address, click to read: Linux Centos7 deployment environment installation -CentOS

If you like it, please pay attention weyoung public number ...

 


wechat_qrcode-2019115195545

Guess you like

Origin www.cnblogs.com/nelucifer/p/11588636.html