Manjaro/Arch: 설치된 패키지를 여러 컴퓨터에 동기화된 상태로 유지

Manjaro/Arch: 설치된 패키지를 여러 컴퓨터에 동기화된 상태로 유지

나는 두 대의 랩톱과 두 대의 데스크탑에서 여러 Manjaro 설치를 실행하고 있으며 모든 컴퓨터에 동일한 소프트웨어가 필요하고 모든 컴퓨터에 수동으로 설치해야 하는 경우가 종종 있습니다. 내 컴퓨터에 패키지 설치를 동기화하는 방법이 있나요? 대역폭을 절약하고패키지 캐시 설정내 관심이 아닙니다. 내가 찾고 있어요맨 위여러 대의 컴퓨터를 업데이트하는 기능을 제공하지만 설치된 소프트웨어를 동기화하지 않는 한 패키지만 최신 상태로 유지합니다.

답변1

이 답변은 설치된 패키지에 대한 스크립트를 수집하라는 OP의 요청(자세한 내용은 OP 질문에 대한 설명 참조)에서 나온 것입니다.

다음 스크립트는 RHEL(Red Hat Enterprise Linux)용입니다. 다른 시스템을 실행하는 경우 시스템에 맞게 특정 패키지 관리자 명령을 업데이트하여 계속 사용할 수 있습니다.

#!/bin/bash
# VARS
# declare the hostnames of your servers. it requires to have a config file inside ./ssh with the connection information.
HOSTS=" prd_webserver1 prd_webserver2 prd_db1 prd_db2 prd_frontend1 prd_frontend2"
# create a store directory on the path were the script is
store="artifact_store"
# declare roles based on hostname
role_store="webserver db frontend"

# Create artifact_store directory
[ ! -d "$store" ] && mkdir -p "$store"

# Create role store directories
for ROLE_DIR in ${role_store}; do
[ ! -d "$store/${ROLE_DIR}" ] && mkdir -p "$store/${ROLE_DIR}"
done

CMDS=$(cat <<CMD
 bash -c "sudo yum -q check-update --security --exclude=kernel* |awk '{print $ 1}' > /tmp/updatelist.log"
CMD
)

# Create update lists
for HOSTNAME in ${HOSTS}; do
ssh -t ${HOSTNAME} "$CMDS"
scp ${HOSTNAME}:/tmp/updatelist.log ./updatelist_${HOSTNAME}.log
mv updatelist_${HOSTNAME}.log $store
done

# Create role directories and move artifacts
for ROLE in ${role_store}; do
mv $store/*${ROLE}*.log $store/${ROLE}
cat $store/${ROLE}/updatelist_*.log >> $store/${ROLE}/updatelist.combined
cat $store/${ROLE}/updatelist.combined |sort |uniq >> $store/${ROLE}/updatelist.final
rm $store/${ROLE}/updatelist.combined
done

관련 정보