基于docker搭建jenkins 去构建linux
1. 创建容器
keven@xacszpc:~$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE gitlab/gitlab-ce latest 0943abb03ebc 2 weeks ago 2.87GB dwtmjps/myjenkins v2.0 3c0a7d73e565 4 months ago 11.2GB dwtmjps/myjenkins v1.0 0237ee0bfe58 8 months ago 2.22GB keven/jenkins 20230402 0237ee0bfe58 8 months ago 2.22GB jenkins/jenkins latest e701a1b6fb83 8 months ago 471MB hello-world latest feb5d9fea6a5 2 years ago 13.3kB keven@xacszpc:~$ mkdir jenkins_crade keven@xacszpc:~$ sudo docker run -d --name crade -p 8088:8080 -u root \ -v /home/jenkins_crade:/var/jenkins_crade \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /usr/bin/docker:/usr/bin/docker \ -v /usr/lib/x86_64-linux-gnu/libltdl.so.7:/usr/lib/x86_64-linux-gnu/libltdl.so.7 \ -v jenkins/jenkins:latest keven@xacszpc:~$ sudo docker logs cradle #查看初始密码
2.更新源:
sed -i 's#http://deb.debian.org#https://mirrors.ustc.edu.cn#g' /etc/apt/sources.list
To build openwrt
apt-get install libncurses5-dev zlib1g-dev gawk flex patch git-core g++ subversion
apt-get -y install build-essential
Debian中安装老版本的gcc
wget 'http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8_4.8.5-4ubuntu8_amd64.deb' wget 'http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8_4.8.5-4ubuntu8_amd64.deb' wget 'http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/cpp-4.8_4.8.5-4ubuntu8_amd64.deb' wget 'http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb' wget 'http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/libgcc-4.8-dev_4.8.5-4ubuntu8_amd64.deb' wget 'http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/libasan0_4.8.5-4ubuntu8_amd64.deb' wget 'http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/g++-4.8_4.8.5-4ubuntu8_amd64.deb' wget 'http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/libstdc++-4.8-dev_4.8.5-4ubuntu8_amd64.deb' 安装顺序 dpkg -i gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb dpkg -i libasan0_4.8.5-4ubuntu8_amd64.deb dpkg -i libgcc-4.8-dev_4.8.5-4ubuntu8_amd64.deb dpkg -i cpp-4.8_4.8.5-4ubuntu8_amd64.deb gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb dpkg -i gcc-4.8_4.8.5-4ubuntu8_amd64.deb dpkg -i libstdc++-4.8-dev_4.8.5-4ubuntu8_amd64.deb g++-4.8_4.8.5-4ubuntu8_amd64.deb
使用update-alternatives管理多个版本gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 48 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
选择4.8:
sudo update-alternatives --config gcc
问题:
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
执行:
echo "export set FORCE_UNSAFE_CONFIGURE=1" >> /etc/profile source /etc/profile