Skip to content

Instantly share code, notes, and snippets.

@yacchip
Last active April 17, 2023 13:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Prep the OS environment for moving repos between Nexus instances
# Ubuntu 22.04.2 LTS (Jammy Jellyfish)
# user: nexus(uid=200,gid=200), PWD=/home/nexus, LANG=C.UTF-8
# Nexus Repository Manager 3.29.2 exposed on localhost:8081
# Nexus Repository Manager 3.48.0 exposed on localhost:8082
# install JDK
sudo apt-get install openjdk-17-jdk
# install mvn CLI
curl -s https://dlcdn.apache.org/maven/maven-3/3.9.1/binaries/apache-maven-3.9.1-bin.tar.gz | tar -xz
echo -e '# set PATH so it includes apache maven bin if it exists
if [ -d "$HOME/apache-maven-3.9.1/bin" ] ; then
PATH="$HOME/apache-maven-3.9.1/bin:$PATH"
fi' >> .profile
source .profile
# test out if mvn works
mvn -v
# Ubuntu 22.04.2 LTS (Jammy Jellyfish)
# user: nexus(uid=200,gid=200), PWD=/home/nexus, LANG=C.UTF-8
# Nexus Repository Manager 3.29.2 exposed on localhost:8081
# Nexus Repository Manager 3.48.0 exposed on localhost:8082
sudo apt-get install pip
pip3 install virtualenv
# prepare environment to connect to Nexus 3.29.2 (old) instance
virtualenv .venv-nex-old
source .venv-nex-old/bin/activate
pip install nexus3-cli==3.4.0
# test cli version
nexus3 --version
deactivate
# prepare .env file and alias for old instance
echo 'export NEXUS3_PASSWORD=password
export NEXUS3_USERNAME=username
export NEXUS3_URL="http://localhost:8081"' > ~/.nex-old
echo -e 'alias old=\x27source ~/.nex-old && source ~/.venv-nex-old/bin/activate && echo -e "cat .nex-old\x5cn$(cat ~/.nex-old)"\x27' >> ~/.bashrc
source ~/.bashrc
# prepare environment to connect to Nexus 3.48.0 (new) instance
virtualenv .venv-nex-new
source .venv-nex-new/bin/activate
pip install nexus3-cli==4.1.8
# test version
nexus3 --version
deactivate
# prepare .env file and alias for new instance
echo 'export NEXUS3_PASSWORD=password
export NEXUS3_USERNAME=username
export NEXUS3_URL="http://localhost:8082"' > ~/.nex-new
echo -e 'alias new=\x27source ~/.nex-new && source ~/.venv-nex-new/bin/activate && echo -e "cat .nex-new\x5cn$(cat ~/.nex-new)"\x27' >> ~/.bashrc
source ~/.bashrc
# prepare alias for deactivating the environments
echo -e 'alias deact=\x27deactivate && unset NEXUS3_{PASSWORD,USERNAME,URL}\x27' >> ~/.bashrc
source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment