keyfall / xuexibiji

3 stars 0 forks source link

树莓派centos7 #64

Open keyfall opened 1 year ago

keyfall commented 1 year ago

树莓派使用centos7用完后感觉整下载包经常找不见,使用docker去启动其他服务,有时会很麻烦,比如我弄了好几天的transmisson,使用docker启动后,不太好启动,总是restart,也可能是我技术不行,教程也有些不那么详尽,因此我换了archlinux系统,当个邪教徒试试

先扩容 rootfs-expand

/etc/yum.repos.d目录下 配置yum源 epel.repo

[epel]
name=Epel rebuild for armhfp
baseurl=https://armv7.dev.centos.org/repodir/epel-pass-1/
enabled=1
gpgcheck=0

CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32

#released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/updates/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/extras/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirrors.ustc.edu.cn/centos-altarch/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32

ceph.repo

[ceph]
name=ceph
baseurl=http://mirrors.163.com/ceph/rpm-jewel/el7/aarch64/
gpgcheck=0
[ceph-noarch]
name=cephnoarch
baseurl=http://mirrors.163.com/ceph/rpm-jewel/el7/noarch/
gpgcheck=0

清理旧包 yum clean all

yum update时可能报错,所以先进行这步 报错GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32" 解决方法:rpm --import /etc/pki/rpm-gpg/RPM*

生成yum源缓存并且更新源 yum makecache && yum update

keyfall commented 1 year ago

安装docker yum install docker

安装好后报错 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 我这里是没有启动 ls /var/run | grep docker service docker start 第一个是查看docker是否启动,第二个是启动doccker 全部原因

docker pull yrzr/gitlab-ce-arm64v8:latest

mkdir -p /opt/data/gitlab-ce/conf
mkdir -p /opt/data/gitlab-ce/logs
mkdir -p /opt/data/gitlab-ce/data

运行命令: docker run --detach --name gitlab-ce --restart always --privileged --publish 2222:22 --publish 80:80 --publish 443:443 --hostname localhost --volume /opt/data/gitlab-ce/conf:/etc/gitlab:z --volume /opt/data/gitlab-ce/logs:/var/log/gitlab:z --volume /opt/data/gitlab-ce/data:/var/opt/gitlab:z yrzr/gitlab-ce-arm64v8:latest

启动之后可以使用docker ps查看 树莓派整的可能要等2-3分钟,反正立马看,看不了

修改gitlab密码 vim /opt/data/gitlab-ce/conf/gitlab.rb

external_url 'http://192.168.1.105/'  #gitlab宿主机ip:端口号,这里因为80端口映射的,所以可以不加
gitlab_rails['gitlab_ssh_host'] = '192.168.1.105' #gitlab宿主机ip
gitlab_rails['gitlab_shell_ssh_port'] = 2222 #这里是docker中gitlab22端口的映射
docker  exec  -it  gitlab  /bin/bash

#进入容器
gitlab-ctl reconfigure #重启配置
#使用exit;退出容器  重启gitlab
docker  restart  gitlab或者容器号

重启后再重新进入容器,使用下面命令
gitlab-rails console -e production
user = User.where(id: 1).first
user.password = '123456'
user.password_confirmation = '123456'
user.save!
#依次执行改密
keyfall commented 1 year ago

配置hostname hostnamectl set-hostname newhostname

配置wifi

nmcli  d  # 查看网络连接情况

nmcli  d  wifi  # 查看周围的wifi

nmcli d wifi connect yourSSID password 'yourpassword'  # 连接wifi  

nmcli d  show wlan0  # 查看wlan0的状态

nmcli r wifi on #开启wifi,不确定是否是开启自动连接
keyfall commented 1 year ago

报错GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-AltArch-Arm32" 解决方法:rpm --import /etc/pki/rpm-gpg/RPM*

keyfall commented 1 year ago

安装python3.9 确保您的系统已经安装了开发工具和一些必需的库:

sudo yum groupinstall "Development tools"
sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel expat-devel

下载 Python 3.9 的源代码: wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz 解压缩文件并进入目录:

tar -xzf Python-3.9.0.tgz
cd Python-3.9.0

配置安装选项: ./configure --enable-optimizations 编译并安装 Python 3.9: make altinstall 请注意,使用 altinstall 而不是 install 命令可以避免覆盖系统默认的 Python 版本。

进行环境变量配置 ln -s /usr/local/bin/python3.9 /usr/bin/python3 ln -s /usr/local/bin/pip3.9 /usr/bin/pip 默认/usr/bin/python3已经存在,先删掉就好

进行pip换源

mkdir ~/.pip
touch ~/.pip/pip.conf

编辑pip.conf

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com

尝试下载的时候,建议更新最新版pip /usr/local/bin/python3.9 -m pip install --upgrade pip