Compiled from the “Development Tips” series, collecting common problems and solutions in CentOS server operations.
1. Upgrading the Docker Version
- Uninstall the old version of Docker
1
2
3
4
5
6
| $yum remove docker \
docker-common \
container-selinux \
docker-selinux \
docker-engine \
docker-engine-selinux
|
Images, containers, data, and networks stored in /var/lib/docker/ are all preserved.
- Install dependencies
1
| yum install -y yum-utils device-mapper-persistent-data lvm2
|
- Install Docker
1
2
3
| yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
|
2. Adding a Swap Partition File
Check the current partition situation:
Increase the swap size, around 2G:
1
| dd if=/dev/zero of=/var/swap bs=1024 count=2048000
|
Set up the swap file:
Activate and enable the swap partition immediately:
To start it automatically at system boot, edit /etc/fstab and add a line:
1
| /var/swap swap swap defaults 0 0
|
Reclaim the swap space:
1
2
| swapoff /var/swap
rm /var/swap
|
3. Installing minikube
Add the installation source:
1
2
3
4
5
6
7
8
9
| cat <<'EOF' > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
|
Start the installation:
1
2
3
4
| yum -y install kubectl
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O minikube
chmod +x minikube
mv minikube /usr/local/bin/
|
On Linux, minikube supports two kinds of virtual machines, VirtualBox and KVM. But if you are using a cloud server, where CPU virtualization cannot be enabled, you can use the host machine’s Docker environment:
1
| minikube start --vm-driver=none
|
See this article.
4. Installing a Specific Docker Version
Add Aliyun’s docker-ce repository:
1
2
| yum install -y yum-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
|
List the available docker-ce versions:
1
2
3
4
5
6
| yum list docker-ce --showduplicates
docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable
docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.9-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.8-3.el7 docker-ce-stable
|
Install a specific version of docker-ce:
1
| yum install -y docker-ce-19.03.8-3.el7
|
Start it:
1
2
| systemctl start docker
systemctl enable docker
|
5. Building and Installing Python 3.7
Install dependencies:
1
| yum install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils libffi-devel
|
Download the source package:
1
2
| cd /usr/src
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
|
Start the installation:
1
2
3
4
| tar xzf Python-3.7.0.tgz
cd Python-3.7.0
./configure --enable-optimizations
make altinstall
|
Check the version information:
Install pip:
1
2
| wget https://bootstrap.pypa.io/get-pip.py -O - | python3.7
pip3 -V
|
6. Upgrading and Installing Git 2
- Remove the old version:
- Install the epel-release repository:
1
| yum install epel-release
|
- Install the IUS repository:
1
| yum install https://centos7.iuscommunity.org/ius-release.rpm
|
- Install git2u:
7. /etc/rc.local Does Not Run Automatically at Boot
Inspecting the contents of /etc/rc.local reveals:
1
2
| # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
|
On CentOS 7 it is recommended to create a systemd unit for auto-start at boot.
If you need to use the old approach, you must add it to /etc/rc.d/rc.local. At the same time, run chmod +x /etc/rc.d/rc.local to grant executable permissions.
8. Checking Port Usage
1
2
| yum install -y lsof
lsof -i:30948
|
1
2
| yum install -y net-tools
netstat -apn | grep 30948
|
9. Using tcpdump to Inspect Data on a Specific Port from a Specific Source IP
1
2
| yum install -y tcpdump
tcpdump -i eth0 -nnA 'port 30948 and src host 192.168.10.3' -vv
|
10. Installing GLIBC 2.18
Check the installed GLIBC version:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| strings /lib64/libc.so.6 |grep GLIBC_*
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
|
Install GLIBC 2.18:
1
2
3
4
5
6
7
| wget http://ftp.gnu.org/gnu/glibc/glibc-2.XX.tar.gz
tar -xvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build && cd build
../configure --prefix=/usr
make -j4
make install
|