陈沙克

Jul 152021
 

记录一下,清华和中科大的repo设置

##清华

sed -e 's|^mirrorlist=|#mirrorlist=|g' \
    -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' \
    -i.bak \
    /etc/yum.repos.d/CentOS-Base.repo

sed -e 's!^metalink=!#metalink=!g' \
    -e 's!^#baseurl=!baseurl=!g' \
    -e 's!//download\.fedoraproject\.org/pub!//mirrors.tuna.tsinghua.edu.cn!g' \
    -e 's!http://mirrors!https://mirrors!g' \
    -i.bak \
	/etc/yum.repos.d/epel.repo
	
	

sed -e 's|^mirrorlist=|#mirrorlist=|g' \
    -e 's#elrepo.org/linux#mirrors.tuna.tsinghua.edu.cn/elrepo#g' \
    -i.bak \
    /etc/yum.repos.d/elrepo.repo


	
##中科大	
	
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
    -e 's|^#baseurl=http://mirror.centos.org|baseurl=http://mirrors.ustc.edu.cn|g' \
    -i.bak \
    /etc/yum.repos.d/CentOS-Base.repo

sed -e 's!^metalink=!#metalink=!g' \
    -e 's!^#baseurl=!baseurl=!g' \
    -e 's!//download\.fedoraproject\.org/pub!//mirrors.ustc.edu.cn!g' \
    -i.bak \
	/etc/yum.repos.d/epel.repo
	
	
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
    -e 's#elrepo.org/linux#mirrors.ustc.edu.cn/elrepo#g' \
    -i.bak \
    /etc/yum.repos.d/elrepo.repo
Jul 152021
 

以前一直都是有apache,这次就刚好有需求,学习一下Nginx,日后估计是需要把blog的apache换成nginx。我其实就是需要把一个目录让大家可以通过web ip地址直接访问和下载。

我需要共享的目录 /home

安装nginx,需要epel reoi

yum install nginx

配置nginx

cat /etc/nginx/conf.d/data.conf 
server {
        listen       80 default_server;
        root         /home/;

        location / {
                autoindex on;
                autoindex_localtime on;
		autoindex_exact_size off; 
        }
}

下面就是重启服务就可以,倒是很简单。

systemctl enable nginx
systemctl start nginx

直接通过ip地址访问,文件大小是用G,MB显示。效果不错。

Jul 052021
 

其实这是在我定制的镜像里进行,安装过程是非常快速的,我对CentOS 7.6 镜像的定制

  • 安装docker ,并且配置docker使用阿里云代理
  • kubesphere要求的包
  • 升级内核到5.4版本,cilium 有内核版本的要求

基本参考下面的过程就可以轻松搞定

export KKZONE=cn
wget https://kubernetes.pek3b.qingstor.com/kubekey/releases/download/v1.1.0/kubekey-v1.1.0-linux-amd64.tar.gz
tar zxvf kubekey-v1.1.0-linux-amd64.tar.gz
chmod +x kk
#### all in one
./kk create cluster --with-kubernetes v1.20.4 --with-kubesphere v3.1.0 -y
###多节点或者定制默认设置,例如修改网络插件 cilium
./kk create config --with-kubernetes v1.20.4

#修改配置config-sample.yaml,
./kk init os -f config-sample.yaml
./kk create cluster -f config-sample.yaml --with-kubesphere v3.1.0 -y

如果要删除群集,重新部署一遍,也简单。

./kk delete cluster -f config-sample.yaml
Jul 052021
 
  • 将光标移动到行首control + a
  • 将光标移动到行尾control + e
  • 清除屏幕control + l
  • 搜索以前使用命令:control + r
  • 清除当前行control + u
  • 清除至当前行尾:control + k
  • 单词为单位移动option + 方向键

对于linux下

  • ctrl+a 行首
  • ctrl+e 行尾
  • ctrl+k 删除至行尾
Jul 012021
 

经常测试网络的时候,需要内核版本支持,所以需要升级内核。

查看当前内核版本

uname -smr

improt内核的repo

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
yum list available --disablerepo='*' --enablerepo=elrepo-kernel
  • kernel-lt indicates a stable LTS ( long term support)
  • kernel-ml signifies a mainline release that offers short support term but provides more frequent updates. 

习惯就选择LTS的版本

yum --enablerepo=elrepo-kernel install kernel-lt

如果你希望装维护版本

yum --enablerepo=elrepo-kernel install kernel-ml

设置默认内核

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
grub2-set-default 0
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot

加快速度,使用国内的repo

sed -i 's#elrepo.org/linux#mirrors.tuna.tsinghua.edu.cn/elrepo#g' /etc/yum.repos.d/elrepo.repo
sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/elrepo.repo
Jul 012021
 

折腾完各种安装方式,就需要一种可以让自己快速搭建学习的环境。

我的实验环境是CentOS 7.6

需要提前把docker先安装好。后续考虑镜像默认docker装好,内核版本升级到5.4,这样用起来就更加方便。

yum install yum-utils device-mapper-persistent-data lvm2 openssl socat conntrack ebtables ipset
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
yum install docker-ce-20.10.6
sudo sh -c 'echo {\"registry-mirrors\": [\"https://fz1p31b1.mirror.aliyuncs.com\"]} > /etc/docker/daemon.json'
systemctl enable --now docker

Kubernetes+Kubesphere

export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.0 sh -
chmod +x kk
./kk create cluster --with-kubernetes v1.20.4 --with-kubesphere v3.1.0

这样就基本装完了。