Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update apt sources #103

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions docker_atom/work/localize/run-config-mirror-aliyun-pub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ export TZ=${TZ:="Asia/Shanghai"}
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
echo "Setup timezone, current date: $(date)"

if [ -f /etc/apt/sources.list ]; then
echo "Found Ubuntu/debian system, setting ubuntu/debian mirror"

sed -i 's/mirrors.*.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' /etc/apt/sources.list
sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' /etc/apt/sources.list
sed -i 's/security.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' /etc/apt/sources.list

sed -i 's/deb.debian.org\/debian/mirrors.aliyun.com\/debian/' /etc/apt/sources.list
eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}"

FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list )
if [ -f $FILE_DEB ]; then
sed -i 's/mirrors.*.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' $FILE_DEB
sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' $FILE_DEB
sed -i 's/security.ubuntu.com\/ubuntu/mirrors.aliyun.com\/ubuntu/' $FILE_DEB
sed -i 's/deb.debian.org\/debian/mirrors.aliyun.com\/debian/' $FILE_DEB
echo "Finished setting ubuntu/debian mirror"
fi

if [ -f "$(which python)" ]; then
Expand Down
17 changes: 9 additions & 8 deletions docker_atom/work/localize/run-config-mirror-aliyun-vpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ export TZ=${TZ:="Asia/Shanghai"}
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
echo "Setup timezone, current date: $(date)"

if [ -f /etc/apt/sources.list ]; then
echo "Found Ubuntu/debian system, setting ubuntu/debian mirror"

sed -i 's/mirrors.*.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' /etc/apt/sources.list
sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' /etc/apt/sources.list
sed -i 's/security.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' /etc/apt/sources.list

sed -i 's/deb.debian.org\/debian/mirrors.cloud.aliyuncs.com\/debian/' /etc/apt/sources.list
eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}"

FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list )
if [ -f $FILE_DEB ]; then
sed -i 's/mirrors.*.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' $FILE_DEB
sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' $FILE_DEB
sed -i 's/security.ubuntu.com\/ubuntu/mirrors.cloud.aliyuncs.com\/ubuntu/' $FILE_DEB
sed -i 's/deb.debian.org\/debian/mirrors.cloud.aliyuncs.com\/debian/' $FILE_DEB
echo "Finished setting ubuntu/debian mirror"
fi

if [ -f "$(which python)" ]; then
Expand Down
17 changes: 9 additions & 8 deletions docker_atom/work/localize/run-config-mirror-tencent-pub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ export TZ=${TZ:="Asia/Shanghai"}
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
echo "Setup timezone, current date: $(date)"

if [ -f /etc/apt/sources.list ]; then
echo "Found Ubuntu/debian system, setting ubuntu/debian mirror"

sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencent.com\/ubuntu/' /etc/apt/sources.list
sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' /etc/apt/sources.list
sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' /etc/apt/sources.list

sed -i 's/deb.debian.org\/debian/mirrors.tencent.com\/debian/' /etc/apt/sources.list
eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}"

FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list )
if [ -f $FILE_DEB ]; then
sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencent.com\/ubuntu/' $FILE_DEB
sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' $FILE_DEB
sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tencent.com\/ubuntu/' $FILE_DEB
sed -i 's/deb.debian.org\/debian/mirrors.tencent.com\/debian/' $FILE_DEB
echo "Finished setting ubuntu/debian mirror"
fi

if [ -f "$(which python)" ]; then
Expand Down
17 changes: 9 additions & 8 deletions docker_atom/work/localize/run-config-mirror-tencent-vpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ export TZ=${TZ:="Asia/Shanghai"}
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
echo "Setup timezone, current date: $(date)"

if [ -f /etc/apt/sources.list ]; then
echo "Found Ubuntu/debian system, setting ubuntu/debian mirror"

sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' /etc/apt/sources.list
sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' /etc/apt/sources.list
sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' /etc/apt/sources.list

sed -i 's/deb.debian.org\/debian/mirrors.tencentyun.com\/debian/' /etc/apt/sources.list
eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}"

FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list )
if [ -f $FILE_DEB ]; then
sed -i 's/mirrors.*.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' $FILE_DEB
sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' $FILE_DEB
sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tencentyun.com\/ubuntu/' $FILE_DEB
sed -i 's/deb.debian.org\/debian/mirrors.tencentyun.com\/debian/' $FILE_DEB
echo "Finished setting ubuntu/debian mirror"
fi

if [ -f "$(which python)" ]; then
Expand Down
17 changes: 9 additions & 8 deletions docker_atom/work/localize/run-config-mirror-tsinghua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ export TZ=${TZ:="Asia/Shanghai"}
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
echo "Setup timezone, current date: $(date)"

if [ -f /etc/apt/sources.list ]; then
echo "Found Ubuntu/debian system, setting ubuntu/debian mirror"

sed -i 's/mirrors.*.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' /etc/apt/sources.list
sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' /etc/apt/sources.list
sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' /etc/apt/sources.list

sed -i 's/deb.debian.org\/debian/mirrors.tuna.tsinghua.edu.cn\/debian/' /etc/apt/sources.list
eval "export $(cat /etc/os-release | grep ID=)" && export OS_ID=${ID} && echo "Found ${ID} system, setting mirror for ${ID}"

FILE_DEB=$([ -f /etc/apt/sources.list.d/${OS_ID}.sources ] && echo /etc/apt/sources.list.d/${OS_ID}.sources || echo /etc/apt/sources.list )
if [ -f $FILE_DEB ]; then
sed -i 's/mirrors.*.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' $FILE_DEB
sed -i 's/archive.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' $FILE_DEB
sed -i 's/security.ubuntu.com\/ubuntu/mirrors.tuna.tsinghua.edu.cn\/ubuntu/' $FILE_DEB
sed -i 's/deb.debian.org\/debian/mirrors.tuna.tsinghua.edu.cn\/debian/' $FILE_DEB
echo "Finished setting ubuntu/debian mirror"
fi

if [ -f "$(which python)" ]; then
Expand Down
2 changes: 2 additions & 0 deletions docker_atom/work/script-localize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ PROFILE_LOCALIZE=${PROFILE_LOCALIZE:-"default"}
echo "Using PROFILE_LOCALIZE=${PROFILE_LOCALIZE}"

source /opt/utils/localize/run-config-mirror-${PROFILE_LOCALIZE}.sh

# reference: https://github.com/RubyMetric/chsrc/blob/main/src/chsrc.c
16 changes: 6 additions & 10 deletions docker_atom/work/script-setup-db-clients.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,27 @@ source /opt/utils/script-utils.sh
setup_postgresql_client() {
local VER_PG=${PG_MAJOR:-"15"}
# from: https://www.postgresql.org/download/linux/ubuntu/
echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
curl "https://www.postgresql.org/media/keys/ACCC4CF8.asc" | sudo tee /etc/apt/trusted.gpg.d/postgresql.asc
sudo apt-get update
echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
# will download ~9MB files and use ~55MB disk after installation
sudo apt-get -y install "postgresql-client-${VER_PG}"
sudo apt-get update && sudo apt-get -y install "postgresql-client-${VER_PG}"
echo "@ Version of psql client: $(psql --version)"
}


setup_mysql_client() {
sudo apt-get update
# will download ~5MB files and use ~76MB disk after installation
sudo apt-get -y install mysql-client
sudo apt-get update && sudo apt-get -y install mysql-client
echo "@ Version of mysql client: $(mysql --version)"
}


setup_mongosh_client() {
# from: https://www.mongodb.com/docs/mongodb-shell/install/
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-6.0.list
curl -sL https://www.mongodb.org/static/pgp/server-6.0.asc | sudo tee /etc/apt/trusted.gpg.d/mongodb.asc
sudo apt-get update
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-6.0.list
# will download ~38MB files and use ~218MB disk after installation
sudo apt-get -y install mongodb-mongosh
sudo apt-get update && sudo apt-get -y install mongodb-mongosh
echo "@ Version of mongosh client: $(mongosh --version)"
}

Expand All @@ -36,7 +33,6 @@ setup_redis_client() {
# from https://redis.io/docs/getting-started/installation/install-redis-on-linux/
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt-get update
sudo apt-get -y install redis-tools
sudo apt-get update && sudo apt-get -y install redis-tools
echo "@ Version of redis-cli: $(redis-cli --version)"
}
Loading