BCLinux
1、BCLinux卸载license模块
rpm -qa | grep license rpm -e --nodeps bclinux-license-manager-4.0-1.oe1.bclinux.x86_64 --noscripts yum clean all && yum makecache
2、修改密码策略
vim /etc/pam.d/system-auth password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
3、取消ssh连接超时设置
vim /etc/profile export HISTTIMEFORMAT="%F %T `whoami` " set -o vi #TMOUT=180 TMOUT=0 umask 027 source /etc/profile
4、添加epel源
vim /etc/yum.repos.d/epel.repo
[epel] name=Extra Packages for Enterprise Linux 7 - $basearch #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 [epel-debuginfo] name=Extra Packages for Enterprise Linux 7 - $basearch - Debug #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 7 - $basearch - Source #baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1
5、挂载ISO镜像文件
# 方式一(临时挂载,重启失效): mkdir -p /mnt/cdrom/bclinux;mount -o ro /opt/BCLinux-for-Euler-21.10-everything-x86_64.iso /mnt/cdrom # 方式二(永久挂载,重启不失效): # 在/etc/fstab文件中添加以下行,/mnt/cdrom为挂载路径,iso9660为光盘的文件格式 mkdir -p /mnt/cdrom/bclinux;echo "/opt/BCLinux-for-Euler-21.10-everything-x86_64.iso /mnt/cdrom iso9660 loop 0 0" >>/etc/fstab # 挂载所有fstab中指定的文件系统 mount -a
6、新增BCLinux-cdrom.repo文件
vim /etc/yum.repos.d/BCLinux-cdrom.repo
[BCLinux-oe21.10-ISO] name=BC-Linux-release - ISO local baseurl=file:///mnt/cdrom/bclinux gpgcheck=0 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-BCLinux-For-Euler
7、备份其它repo文件
mv BCLinux-for-Euler-21.10-all.repo BCLinux-for-Euler-21.10-all.repo.bak mv BCLinux-for-Euler-21.10-ISO.repo BCLinux-for-Euler-21.10-ISO.repo.bak
8、本地yum源配置,nginx配置
cat /etc/nginx/nginx.conf
server { listen 80 default_server; listen [::]:80 default_server; server_name _; #root /mnt/cdrom; # 启用目录索引,并显示文件列表 #autoindex on; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { # 启用目录索引,并显示文件列表 autoindex on; # 限制多个IP段访问 allow 192.168.140.0/24; allow 192.168.150.0/24; deny all; # 允许yum的方式访问 if ( $http_user_agent ~* 'libdnf' ) { #root html; root /mnt/cdrom; #index index.html index.htm; } # 使用curl命令访问返回404 if ( $http_user_agent ~* 'curl' ) { return 404; } # 其它访问方式跳转到百度 if ( $http_user_agent !~* 'libdnf' ) { rewrite ^/(.*) https://www.baidu.com permanent; } } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } # auth # 安装htpasswd工具, # CentOS:yum install httpd-tools # Ubuntu:apt-get install apache2-utils # 创建登录用户名:linux,密码:123456 # mkdir /etc/nginx/loginuser;htpasswd -bc /etc/nginx/loginuser/htpasswd linux 123456 # https://www.cnblogs.com/cainiaoliu/articles/6406623.html htpasswd命令 #auth_basic "Please input B1 password"; # 设置加密登陆的提示 #auth_basic_user_file /etc/nginx/loginuser/htpasswd; # 设置加密的账号密码文件 # 限制IP段登陆 #allow 192.168.140.0/24; #deny all; }
9、其它bclinux yum配置
vim /etc/yum.repos.d/BCLinux.repo
[base] name=BCLinux-$releasever - Base failovermethod=priority baseurl=http://192.168.140.135/bclinux/ gpgcheck=0 enabled=1 gpgkey=http://192.168.140.135/bclinux/RPM-GPG-KEY-BCLinux-For-Euler
10、清除yum缓存,使用yum list命令测试出现已安装的软件包时,说明配置成功
yum clean all && yum list
11、安装常用软件包,--downloadonly仅下载安装包同时下载依赖包
yum -y install wget bash-completion lrzsz telnet tree yum install --downloadonly --downloaddir=/root lrzsz dnf -y install --downloadonly --destdir=/root lrzsz
12、解压ansible离线文件并安装
tar xf ansible-offline-install.tar.gz && sh ansible/install.sh
13、解压ansible-2.9.27.tar.gz包
rm -fr ansible && tar xf ansible-2.9.27.tar.gz
14、升级ansible到2.9.27版本
cd ansible/
rpm -ivh *.rpm --force --nodeps
15、ssh连接报错
Unable to negotiate with X.X.X.X port 22: no matching host key type found. Their offer: ssh-rsa
解决办法:
vim /root/.ssh/config
Host * HostkeyAlgorithms +ssh-rsa PubkeyAcceptedKeyTypes +ssh-rsa KexAlgorithms +diffie-hellman-group-exchange-sha1
16、用户目录下.bash_profile和.bashrc的关系
登录Linux启动bash时首先会去读取~/.bash_profile文件,.bash_profile文件中显式调用.bashrc,这样~/.bashrc也就得到执行了
[root@localhost ~]$ cat .bash_profile
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH
[root@localhost ~]$ cat .bashrc
# .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias ll='ls -lh' alias ping='ping -c 5' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi
17、清除历史记录
history -c && >~/.bash_history
18、安装Python3.8以上版本
# 安装依赖 dnf install -y libuuid uuid-devel libnsl2-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel libpcap-devel xz-devel libffi-devel # libffi-devel 安装_ctypes模块 # readline-devel 安装readline模块 # zlib zlib-devel 安装zlib模块 # python3-tkinter tkinter tcl-devel tk-devel 安装_tkinter模块 # xz-devel lzma 安装_lzma模块 # libuuid uuid-devel 安装_uuid模块 # sqlite-devel 安装_sqlite3模块 # gdbm-devel 安装_dbm、_gdbm模块 # ncurses-devel 安装_curses、_curses_panel模块 # openssl-devel 安装_ssl模块 # 安装Python wget --no-check-certificate https://www.python.org/ftp/python/3.8.18/Python-3.8.18.tar.xz # 注释掉9,11-13行(可选) vim /root/Python-3.8.18/Modules/_uuidmodule.c 8 #include "Python.h" 9 /* #ifdef HAVE_UUID_UUID_H */ 10 #include <uuid/uuid.h> 11 /* #elif defined(HAVE_UUID_H) 12 #include <uuid.h> 13 #endif */ ./configure --prefix=/etc/python3.8 --enable-shared make && make install cp /root/Python-3.8.18/libpython3.8.so.1.0 /usr/lib64/
19、rabbitmq相关
rabbitmq默认端口号:15672
默认用户名:guest
密码:guest
https://www.cnblogs.com/heruiguo/p/11045288.html # rabbitmq数据备份与还原
参考链接
https://mirrors.cmecloud.cn/ # 移动云开源镜像站(BCLinux下载地址)