I recently set up a Nexus repo manager to store artifacts and be accessible by Jenkins. I used AWS EC2 (t2 medium) CentOS 7. I ran this script in the user data:
#!/bin/bash
yum install java-1.8.0-openjdk.x86_64 wget -y
mkdir -p /opt/nexus/
mkdir -p /tmp/nexus/
cd /tmp/nexus/
NEXUSURL="https://download.sonatype.com/nexus/3/latest-unix.tar.gz"
wget $NEXUSURL -O nexus.tar.gz
EXTOUT=`tar xzvf nexus.tar.gz`
NEXUSDIR=`echo $EXTOUT | cut -d '/' -f1`
rm -rf /tmp/nexus/nexus.tar.gz
rsync -avzh /tmp/nexus/ /opt/nexus/
useradd nexus
chown -R nexus.nexus /opt/nexus
chown -R nexus.nexus /opt/sonatype-work
cat <<EOT>> /etc/systemd/system/nexus.service
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/$NEXUSDIR/bin/nexus start
ExecStop=/opt/nexus/$NEXUSDIR/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
EOT
echo 'run_as_user="nexus"' > /opt/nexus/$NEXUSDIR/bin/nexus.rc
systemctl daemon-reload
systemctl start nexus
systemctl enable nexus
I also added the user 'nexus' to visudo and gave root access.
After all of this, when I sign in via ipaddress:8081 I get the prompt to sign in with username 'admin' and admin.password in the path folder shown. It logs me in but doesn't display the setup wizard. The admin menu isn't shown either. When I click the user 'admin', it says I'm the anonymous user. It seems I'm being logged in as anonymous user. Either that or I don't have admin access for whatever reason. Does anyone have any idea how to fix this?