Jenkins Setup Notes

I was working on an overseas application whose build server was originally located in Shanghai. Due to special circumstances, it needed to be migrated abroad. This post documents the Jenkins migration and configuration process. Prerequisite: Install JDK 11 Using jenv for multi-version Java management: 1 2 3 4 5 6 7 8 9 # Install jenv git clone https://github.com/jenv/jenv.git ~/.jenv echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(jenv init -)"' >> ~/.bashrc source ~/.bashrc # Enable the export plugin and restart the session jenv enable-plugin export exec $SHELL -l Installing Jenkins on CentOS 1 2 3 4 5 6 # Add Jenkins repository and GPG key sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key # Install yum install jenkins Configuring systemd Service 1 2 3 4 sudo vi /etc/systemd/system/jenkins.service sudo systemctl enable /etc/systemd/system/jenkins.service sudo systemctl start jenkins systemctl status jenkins 1 2 3 4 5 6 7 8 9 10 11 12 13 [Unit] Description=jenkins service After=network.target [Service] Type=simple LimitNOFILE=65536 ExecStart=/usr/bin/jenkins User=work Environment="JENKINS_PORT=8082" [Install] WantedBy=multi-user.target Configuring Android SDK 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip unzip commandlinetools-linux-8512546_latest.zip chmod a+x cmdline-tools/ cd cmdline-tools/bin # Install required components via sdkmanager ./sdkmanager --sdk_root=/home/work/workspace/android_sdk --list ./sdkmanager --install 'platforms;android-33' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'build-tools;33.0.0' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'cmdline-tools;7.0' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'build-tools;32.0.0' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'build-tools;31.0.0' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'ndk;25.1.8937393' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'platforms;android-28' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'platforms;android-29' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'platforms;android-30' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'platforms;android-31' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'cmake;3.22.1' --sdk_root=/home/work/workspace/android_sdk ./sdkmanager --install 'cmake;3.10.2.4988404' --sdk_root=/home/work/workspace/android_sdk Fixing SSH Key Permission Issues If you encounter Permissions 0664 for '/home/work/.ssh/jenkins_id_rsa' are too open: ...

June 6, 2022 · 2 min · haoxiqiang

Configuring and Optimizing Shadowsocks Rust

During the recent holiday, I reorganized the home network with the goal of streaming 4K content without buffering. Since I was rebuilding the server anyway, I decided to migrate from the old setup to the new shadowsocks-rust implementation. System Update 1 sudo apt update && sudo apt upgrade Installing and Configuring SS Option 1: Build from Source via Cargo 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # Install Rust toolchain curl https://sh.rustup.rs -sSf | sh # Configure Cargo environment (add to .profile / .bash_profile) # CARGO_HOME sets the installation path # target-cpu=native lets rustc optimize for the current CPU CARGO_HOME=/root/cargo RUSTFLAGS="-C target-cpu=native" source .profile # Install build dependencies sudo apt install build-essential # Install shadowsocks-rust cargo install shadowsocks-rust Option 2: Download Prebuilt Binary 1 2 3 4 wget https://github.com/shadowsocks/shadowsocks-rust/releases/download/v1.14.3/shadowsocks-v1.14.3.x86_64-unknown-linux-gnu.tar.xz tar -xf shadowsocks-v1.14.3.x86_64-unknown-linux-gnu.tar.xz cp ssserver /usr/local/bin chmod a+x /usr/local/bin/ssserver Configuration 1 2 mkdir /etc/shadowsocks vi /etc/shadowsocks/config.json 1 2 3 4 5 6 { "server": "::", "server_port": 8888, "method": "aes-256-gcm", "password": "pw" } Test the server: ...

May 6, 2022 · 3 min · haoxiqiang

Shadowsocks Setup and Optimization

Network instability at the office was affecting work, so I set up a Shadowsocks server on my VPS for source code pulls. The steps below work on most Linux distributions and have been tested on Ubuntu 16.04 and 18.04. 2024 Update: The Python version of shadowsocks used in this guide is no longer maintained. The actively maintained implementation is shadowsocks-rust, which offers better performance and support for modern encryption protocols. For a fresh setup, refer to the shadowsocks-rust documentation. The original Python-based steps are preserved below for reference. ...

December 31, 2019 · 3 min · haoxiqiang

Some Git Operations

Basic commands are well documented elsewhere. Here are some operations I’ve found useful in real projects. ...

September 10, 2015 · 1 min · haoxiqiang