1、配置wget

#] vim /etc/wgetrc 
use_proxy=yes
http_proxy=127.0.0.1:7890
https_proxy=127.0.0.1:7890

即可使用代理下载软件

2、配置git代理和短命令

#] vim .gitconfig
[user]
        name = xxx
        email = xxx@xxx.xxx
[core]
        autocrlf = false
        eol = lf
[color]
        ui = true
[alias]
    sl = log --graph --decorate --pretty=oneline --abbrev-commit --all
    lg = log --color --graph --pretty=format:'%Cred%h%Creset %C(bold blue)<%an>%Creset ---%C(yellow)%d%Creset %s %Cgreen(%cr)' --abbrev-commit
    co = checkout
    st = status
    ci = commit
    br = branch
    df = diff
    ignore = update-index --assume-unchanged
    unignore = update-index --no-assume-unchanged
[http]
        proxy = socks5://127.0.0.1:7891
[https]
        proxy = socks5://127.0.0.1:7891

3、安装C/C++开发工具

yum install epel-release -y 
注意:如果EPEL失败
centos7
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
centos8
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum install rng-tools vim -y
yum groupinstall "Development Tools" -y
yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel -y 
yum install file wget tar bzip2 libcurl-devel -y 
yum install p7zip -y

4、安装cmake

X86安装

wget https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3-Linux-x86_64.sh
./cmake-3.17.3-Linux-x86_64.sh --skip-license --prefix=/usr/
cmake --version

树莓派安装请使用下面的编译安装方式

wget https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5.tar.gz
tar -zxf cmake-3.15.5.tar.gz
cd cmake-3.15.5
./bootstrap --prefix=/usr --datadir=share/cmake --docdir=doc/cmake 
make -j4
sudo make install
cmake --version

5、安装mesa

yum install mesa-libGL
yum install mesa-libOSMesa-devel
# x11库:
$ yum install libXt-devel -y
 
# OpenGL 安装
$ yum install mesa-libGL-devel  mesa-libGLU-devel mesa-libOSMesa-devel -y
 
# OpenGL测试
$ yum install glx-utils -y

# 查看库是否存在
ldconfig -p | grep  libOSMesa.so.8
如果没有libOSMesa.so.8,点击下载libOSMesa.so.8.0.0,放于 /usr/lib64下,并执行软连接:
ln -s /usr/lib64/libOSMesa.so.8.0.0 /lib64/libOSMesa.so

测试一下
glxinfo |grep render # 输出下面的内容即表示安装OK

6、VTK编译

查看osmesa.h路径
find / -name "osmesa.h"
/usr/include/GL/osmesa.h
sudo mkdir -p /opt/thirdpart/vtk
cd VTK-8.90
rm -rf build_linux
mkdir build_linux
cd build_linux
cmake -DBUILD_SHARED_LIBS:BOOL=FALSE \
      -DVTK_USE_X:BOOL=FALSE \
      -DOSMESA_INCLUDE_DIR:PATH=/usr/include \
      -DOSMESA_LIBRARY=/lib64/libOSMesa.so.8 \
      -DVTK_OPENGL_HAS_OSMESA:BOOL=TRUE \
      -DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=TRUE \
      -DCMAKE_INSTALL_PREFIX=/opt/thirdpart/vtk \
      -DVTK_FORBID_DOWNLOADS:BOOL=TRUE \
      -DVTK_MODULE_ENABLE_VTK_hdf5:STRING="NO" \
      -DBUILD_TYPE=Release ..
sudo cmake --build .  --target install

7、安装QT

yum install qt5-qtbase-devel

8、安装Golang开发工具

Golang

9、安装supervisor

supervisor

10、SCL安装高版本的开发工具

SCL(Software Collections)可以让你在同一个操作系统上安装和使用多个版本的软件,而不会影响整个系统的安装包。

(1)安装SCL

sudo yum install centos-release-scl centos-release-scl-rh
sudo yum install scl-utils scl-utils-build

(2)其大约提供下面的软件

Ruby 1.9.3 (ruby193)
Python 2.7 (python27)
Python 3.3 (python33)
PHP 5.4 (php54)
Perl 5.16.3 (perl516)
Node.js 0.10 (nodejs010)
MariaDB 5.5 (mariadb55)
MySQL 5.5 (mysql55)
PostgreSQL 9.2 (postgresql92)

(3)查看可用的软件

sudo yum list available | grep scl

(4)查找和安装Python

sudo yum list available | grep scl | grep python38
sudo yum install rh-python38
scl enable rh-python38 bash
测试一下
[root@devops ~]# python --version
Python 3.8.0

(5)查找和安装gcc

sudo yum list available | grep scl | grep devtoolset
sudo yum install devtoolset-9
scl enable devtoolset-9 bash
测试一下
[root@devops ~]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-9/root/usr/libexec/gcc/aarch64-redhat-linux/9/lto-wrapper
Target: aarch64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-9/root/usr --mandir=/opt/rh/devtoolset-9/root/usr/share/man --infodir=/opt/rh/devtoolset-9/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-9.3.1-20200408/obj-aarch64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --build=aarch64-redhat-linux
Thread model: posix
gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC) 
永久生效
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile

(6)查找和安装clang

sudo yum list available | grep scl | grep llvm-toolset
sudo yum install llvm-toolset-7.0
scl enable llvm-toolset-7.0 bash
测试一下
~]# clang -v
clang version 7.0.1 (tags/RELEASE_701/final)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/rh/llvm-toolset-7.0/root/usr/bin
Found candidate GCC installation: /opt/rh/devtoolset-8/root/usr/lib/gcc/aarch64-redhat-linux/8
Found candidate GCC installation: /usr/lib/gcc/aarch64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/aarch64-redhat-linux/4.8.5
Selected GCC installation: /opt/rh/devtoolset-8/root/usr/lib/gcc/aarch64-redhat-linux/8
Candidate multilib: .;@m64
Selected multilib: .;@m64

(7)查找和安装Rust

yum list available | grep rust
yum install rust-toolset-7
source /opt/rh/rust-toolset-7/enable
cargo --version
永久生效
echo "source /opt/rh/rust-toolset-7/enable" >>/etc/profile

(8)查找和安装node

yum --enablerepo=centos-sclo-rh -y install rh-nodejs12
scl enable rh-nodejs12 bash
测试一下
]# node -v
v12.16.1

(9)安装php73

sudo yum list available | grep scl | grep php73
sudo yum install rh-php73

echo "source /opt/rh/rh-php73/enable" >>/etc/profile

(10)查看已经安装的

scl --list 

(11)安装iotop and iostat

yum install iotop sysstat -y

iotop:查看系统进程占用io情况

iostat -dmx 1: 查看磁盘io使用情况,每秒更新

(12)安装 exfat

sudo rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
sudo yum install exfat-utils fuse-exfat
参考:
https://linuxize.com/post/how-to-mount-an-exfat-drive-on-centos-7/

11、时区设置和时间同步

设置时区
timedatectl set-timezone Asia/Shanghai
查看时间
date -R
时间同步
timedatectl set-ntp yes
yum -y install ntp
systemctl enable ntpd
systemctl start ntpd
ntpdate -u cn.pool.ntp.org
查看时间验证是否OK
date -R

盒盖不休眠

vim /etc/systemd/logind.conf

修改
我们把HandleLidSwitch后面的suspend修改为lock,即:
HandleLidSwitch=lock
注意,如果配置项前面有#号,要删掉,#是注释的意思,
lock 仅锁屏,计算机继续工作。

必须要使用如下命令才能使上面的配置生效
systemctl restart systemd-logind

install ssh-server

systemctl stop iptables
systemctl start sshd
systemctl status sshd
systemctl enable sshd
参考
https://phoenixnap.com/kb/how-to-enable-ssh-centos-7

安装远程桌面服务

yum -y install xrdp
systemctl start xrdp && systemctl enable xrdp

window通过自带的远程桌面访问或者Linux通过Remmina 访问填入ip+用户名+密码即可实现远程桌面访问

安装VNC

##安装vnc服务
通过yum search vnc 查找可以搜索到的vncserver,建议安装tigervnc-server,安装命令为  
yum install tigervnc-server -y
 
##开启vncserver
vncserver
export DISPLAY=localhost:1  //永久生效:可以添加到 /etc/profile 可以使用 glxinfo |grep render来验证是否生效
source  /root/.bashrc
xhost +
如果在运行vncserver时,提示localhost:1被占用,此时需要运行rm -rf /tmp/.X11-unix/X1命令进行清除,清除完成后再执行后续命令,或者根据提示新建另外的DISPLAY环境变量。
 
(# service vncserver start/stop/restart   关闭具体的vncserver命令:vncserver -kill :1       vncserver -kill :2)
 
 
# 配置和运行
vim  /etc/sysconfig/vncservers
添加,给每个用户创建自己的vncserver
VNCSERVERS="1:root  2:abc"
VNCSERVERARGS[1]="-geometry 1920x1080"
VNCSERVERARGS[2]="-geometry 1920x1080"
 
 
在root用户下运行vnc:
vncserver -:1  
停止:vncserver -kill :1
 
 
在普通用户abc下运行vnc
vncserver -:2  
停止:vncserver -kill :2

启动
vncserver :1 -geometry 1920x1080 -dpi 100
vncserver -kill :1

编译升级gcc && glibc

https://bbs.huaweicloud.com/blogs/detail/103318

CentOS升级到GLIBC2.31
1) 源码编译升级gcc9.3.0 
wget https://mirrors.aliyun.com/gnu/gcc/gcc-9.3.0/gcc-9.3.0.tar.gz
cp gcc-9.3.0.tar.gz /opt
cd /opt
tar -xzvf gcc-9.3.0.tar.gz
cd gcc-9.3.0/
vim ./contrib/download_prerequisites

将"ftp://gcc.gnu.org/pub/gcc/infrastructure/" 修改为 "https://gcc.gnu.org/pub/gcc/infrastructure/"
[root@master gcc-9.3.0]# ./contrib/download_prerequisites 
2021-08-25 17:46:57 URL:https://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925/669925] -> "./mpc-1.0.3.tar.gz" [1]
2021-08-25 17:46:59 URL:https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 [1658291/1658291] -> "./isl-0.18.tar.bz2" [1]
gmp-6.1.0.tar.bz2: OK
mpfr-3.1.4.tar.bz2: OK
mpc-1.0.3.tar.gz: OK
isl-0.18.tar.bz2: OK
All prerequisites downloaded successfully.

查看核数,用于并行编译核数指定
cat /proc/cpuinfo| grep "processor"| wc -l

mkdir build
cd build
../configure --enable-checking=release --enable-language=c,c++ --disable-multilib --prefix=/usr

make -j8
make install

检查一下
cd /usr/lib64
ll libstdc++*
gcc -v
gcc --version


2) 安装make4.3
wget https://mirrors.aliyun.com/gnu/make/make-4.3.tar.gz
tar zxvf make-4.3.tar.gz
cd make-4.3/
mkdir build
cd build
../configure --prefix=/usr && make && make install

make -v

3) 安装glibc-2.31 
cd /opt
wget https://mirrors.aliyun.com/gnu/glibc/glibc-2.31.tar.gz
tar -zxf glibc-2.31.tar.gz
cd glibc-2.31/
cat INSTALL | grep -E "newer|later"
mkdir build
cd build
../configure  --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin --disable-sanity-checks --disable-werror
yum install python3
make -j6
make install
make localedata/install-locales

参考