Mounted disk space size
df -h
1 ) View disk partition information
fdisk -l
Appears similar
Disk/dev/vdb:1073.7 GB,1073741824000 bytes, 2097152000 sectors
Units =Sector of1*512=512 bytes
Sector size(logic/physical): 512 bytes/512 bytes
I/O size(The smallest/optimal): 512 bytes/512 bytes
/dev/vdb
format partitionmkfs.ext4 /dev/vdb
mkdir /data
mount /dev/vdb /data
After the above configuration, the disk will not be automatically mounted after booting. The configuration for automatic mounting is as follows
vim /etc/fstab
Add at the end of the file
/dev/vdb /data ext4 defaults 00
Save and exit ESC``:wq
df -hl
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
yum makecache
Centos/redhat/alios:
yum install -y chrony
ubuntu/debian:
apt-get install chrony
sed -i "/server/d"/etc/chrony.conf
vim /etc/chrony.conf
Add to
server ntp.aliyun.com iburst
systemctl restart chronyd
or
service chronyd restart
chronyc tracking
or
date
CentOS7
systemctl enable chronyd.service
CentOS6
chkconfig chronyd on
Features | CentOS7 | CentOS6 |
---|---|---|
View self-starting services | ls /etc/systemd/system/multi-user.target.wants/systemctl list-unit-files | chkconfig --list |
Start on boot | systemctl enable nginx.service | chkconfig nginx on |
Cancel auto start | systemctl disable nginx.service | chkconfig nginx off |
Start service | systemctl start nginx.service | service nginx start |
Stop service | systemctl stop nginx.service | service nginx stop |
Restart service | systemctl restart nginx.service | service nginx restart |
Load failed service | systemctl –failed | |
Reload | systemctl reload nginx.service | |
View status | systemctl status nginx.service |
whereis nginx
ssh [email protected]
root
is the username
112.112.112.112
Server ip
reboot
Install Memcached
Installation dependencies
yum install -y libevent libevent-deve
Install MemCached
yum install memcached
Run Memcached
CentOS7
systemctl restart memcached
CentOS6
service memcached start
or
/usr/bin/memcached -p 11211-u root -m 256-c 10240
Basic settings of memcached:
Configuration path
CentOS7
vim /etc/sysconfig/memcached
CentOS6
vim /etc/init.d/memcached
shut down
pkill -9 memcached
Set boot up
CentOS7
systemctl enable memcached.service
CentOS6
chkconfig memcached on
Cancel startup
CentOS7
systemctl disable memcached.service
CentOS6
chkconfig memcached off
Official download of JDK URL
Or link: https://pan.baidu.com/s/1JdPCMMEq178hXV5V4Ild3Q Password: 03l1
For example, the downloaded file is jdk-8u221-linux-x64.rpm
Change file permissions
chmod 755 jdk-8u221-linux-x64.rpm
installation
rpm -ivh jdk-8u221-linux-x64.rpm
The path after installation is /usr/java/jdk1.8.0_221-amd64
Delete Files
rm jdk-8u221-linux-x64.rpm
Query java version
java -version
View java-home
echo $JAVA_HOME
If it is empty, configure java-home
, otherwise you cannot configure Tomcat
as a service
Open the file /etc/profile
vi /etc/profile
Add at the end of the profile
file:
export JAVA_HOME=/usr/java/jdk1.8.0_221-amd64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
Configuration takes effect immediately
source /etc/profile
Inquire
yum list tomcat*
installation
yum -y install tomcat
Start tomcat
service tomcat start
Set to boot
chkconfig tomcat on
The default tomcat folder path
cd /usr/share/tomcat
(1) download
If the download address is not available, get a new address from http://tomcat.apache.org/
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.42/bin/apache-tomcat-8.5.42.tar.gz
(2) installation
tar -xzvf apache-tomcat-8.5.42.tar.gz
mv apache-tomcat-8.5.42/opt/tomcat8
run
cd /opt/tomcat8/bin
. /startup.sh
(3) Configuration
It is not safe to use root in a production environment, so
useradd -s /sbin/nologin tomcat
chown -R tomcat:tomcat /opt/tomcat8
For service, start with the operating system
cd /opt/tomcat8/bin
tar -xzvf commons-daemon-native.tar.gz
cd commons-daemon-1.1.0-native-src/unix/./configure
make
cp jsvc ../..
cd ../..
Error 1
configure: error: no acceptable C compiler found in $PATH
Solve 1
yum -y install gcc
Open daemon.sh
cd /opt/tomcat8/bin
vi daemon.sh
At the beginning of the text, which is below the comment, add the following five lines of content
# chkconfig:23451090
# description: Starts and Stops the Tomcat daemon.
JAVA_HOME=/usr/java/jdk1.8.0_201-amd64
CATALINA_HOME=/opt/tomcat8
CATALINA_OPTS="-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m"
Configure to prevent log Chinese garbled
Find JAVA_OPTS=
and modify it to
JAVA_OPTS="-Dfile.encoding=UTF8 -Dsun.jnu.encoding=UTF8"
Save and exit
: wq
Add to service
cp daemon.sh /etc/init.d/tomcat8
chkconfig --add tomcat8
boot
chkconfig tomcat8 on
an examination
chkconfig --list|grep tomcat8
Start service
service tomcat8 start
Delete service
service tomcat8 stop
chkconfig tomcat8 off
chkconfig --del tomcat8
rm -rf /etc/init.d/tomcat8
Firewall add trust rules
open a file
vim /etc/sysconfig/iptables
Add rule
- A INPUT -m state --state NEW -m tcp -p tcp --dport 8080-j ACCEPT
Restart firewall
service iptables restart
Install Apache
yum install httpd httpd-devel
Uninstall
yum -y remove httpd*
Start apache
service httpd start
Set to boot
chkconfig httpd on
Reload configuration
service httpd reload
View version
httpd -v
Configuration file location /etc/httpd/conf/httpd.conf
Set up virtual host directory
Add at the end of the file
Listen 9999
NameVirtualHost *:9999<VirtualHost *:9999>
ServerName localhost:9999
DocumentRoot "/data/staticFile"</VirtualHost>
wget -q -O - http://www.atomicorp.com/installers/atomic | sh
yum install php php-cli php-gd php-mysql php-eaccelerator php-zend-optimizer php-pear php-snmp php-bcmath php-mcrypt php-mhash php-soap php-xml php-xmlrpc
yum info php | grep Version
Download and install
wget http://down.safedog.cn/safedog_linux64.tar.gz
tar xzvf safedog_linux64.tar.gz
cd safedog_an_linux64_2.8.19005/
chmod +x *.py
. /install.py
Missing component installation during installation in the previous step
yum install -y mlocate
yum install -y lsof
yum install -y dmidecode
yum install -y pciutils
Login account (cannot log in temporarily)
sdcloud -u Service Cloud Account
Enter the operation interface
sdui
A key installation
wget -O install.sh http://dl.xmirror.cn/a/install.sh && sh install.sh
Recommended Posts