# Centos7
LXC Launch Images:centos/7/amd64 Centos7
LXC exec centos7--/bin/bash
# Verify CENTOS7 version
LXC exec centos7--cat/etc/redhat-release
# Show Network configuration
LXC EXEC centos7--IP addr
# View public IP ifconfig.me website can display native public IP https://ip8.com/
Curl Ifconfig.me
# Network path tracking
Tracepath www.baidu.com
# MariaDB (mysql compatible) prefix LXC exec centos7--
Yum-y Install mariadb Mariadb-server
Systemctl Start mariadb
Systemctl Enable MARIADB
Mysql_secure_installation
# Password: 123456
Create user test identified by ' 123456 ';
Grant SELECT on TestDB.
to Sytest;
Grant Show view on TestDB.To test;
Select Host,user,password from user;
# Remote connection (change table method)
Use MySQL;
Update user Set host = '% ' where user = ' test ';
# Modify root remote Access
GRANT all privileges on
.To ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;
# Data Transfer report got a packet bigger than ' Max_allowed_packet ' bytes temporary modification:
# Modify the #512M, enter it under MYSQ
Set global max_allowed_packet=524288000;
# Refresh Permissions
Flush privileges;
# Reconfigure the reference https://www.linuxidc.com/Linux/2016-03/128880.htm and server my.cnf
Systemctl Restart MARIADB
# Install OpenJDK (Web development compatible orcle JDK) prefix LXC exec centos7--
Yum-y Install JAVA-1.8.0-OPENJDK Java-1.8.0-openjdk-devel
# Get OpenJDK True path
DirName $ (Readlink $ (Readlink $ (whereis java)))
# Configure Java system variable write/etc/profile.d/java_env_export.sh
Echo-e "\ n export java_home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-7.b10.el7.x86_64\n \
Export path= $PATH: $JAVA _home/bin\n \
Export classpath=.: $JAVA _home/jre/lib: $JAVA _home/lib: $JAVA _home/lib/tools.jar\n "\
>/etc/profile.d/java_env_export.sh
# Apply System Variables
source/etc/profile.d/java_env_export.sh
# permanently open, reboot still valid
vi/etc/sysctl.conf file, remove net.ipv4.ip_forward=1 before the # comment, save the file, and then execute sudo sysctl-p to make it effective
# temporarily save port forwarding on the host operating system outside of CentOS, reboot failed
sudo iptables-t nat-a prerouting-p tcp--dport 3306-j DNAT--to 10.138.129.43:3306
sudo iptables-t nat-a prerouting-p tcp-s 192.168.188.0/24--dport 80-j DNAT--to 10.138.129.43:80
sudo iptables-t nat-a prerouting-p tcp-s 192.168.188.0/24--dport 80-j DNAT--to 10.138.129.43:80
# Save All the rules for the current iptables
sudo iptables-save
# Shared Host User Directory
LXC Config device add centos7 mntdir disk Source=/home/ubuntu path=/mnt/outter
# Remove Host user directory
LXC Config device remove Centos7 mntdir
# View Container configuration
LXC config device show Centos7
# Permanently configured from script, without login, self-built/etc/init.d/add-rules and added at the end, add/etc/init.d/add-rules link to/etc/rcx.d/, refer to 50293179
echo 123456 | Sudo-s iptables-t nat-a prerouting-p tcp--dport 80-d 192.168.1.1/24-j DNAT--to 10.0.3.26:80
echo 123456 | Sudo-s iptables-t nat-a prerouting-p tcp--dport 3306-d 192.168.1.1/24-j DNAT--to 10.0.3.26:3306
Ubuntu lxd under Centos7 build openjdk8+mariadb