For more information about installing the Nexus service, see Official Site: http://www.sonatype.com/books/nexus-book/reference/install-sect-install.html.
First, make sure that jdk1.6 has been installed. I use openjdk.
1. Download and install nexus
Download the latest version of nexus on Ubuntu 12.04 server. Unlike the official documentation, I put nexus in the/usr directory instead of the/usr/local directory.
[Plain]
View plain
Copy
Print
?
- Wget http://www.sonatype.org/downloads/nexus-2.0.4-1-bundle.tar.gz
Wget http://www.sonatype.org/downloads/nexus-2.0.4-1-bundle.tar.gz
Music nexus-oss-webapp-2.0.4-1-bundle.tar.gz/usr/
CD/usr
Tar zxvf nexus-oss-webapp-2.0.4-1-bundle.tar.gz
Ln-s nexus-oss-webapp-2.0.4-1 nexus
For future convenience, follow the instructions in the official documentation to set an environment variable and add the following script to the end of the/etc/environment file.
Nexus_home =/usr/nexus
Run_as_user = root
Note:
A./etc/environment the export in the file is not required.
B. The environment variable set by/etc/environment is valid for the entire system. It is recommended to use it in Ubuntu./etc/profile is not recommended. I have tried/etc/profile and it has no effect.
C. The/etc/environment is used. If the root user is not activated, the environment variables set by/etc/environment disappear when the root user switches from another user to the root user through Sudo-s. Therefore, you must enable Root
2. Run
Go to the/usr/nexus/bin/directory and run the following command:
Sudo-S
./Nexus start
Starting nexus OSS...
Started nexus OSS.
The default nexus uses the built-in jetty as the Web server, listening to the local port 8081. By opening the Web http://km9983.gicp.net: 8081/nexus for testing, the user name and password default is: admin/admin123
3. Create a system service
Copy the script that comes with nexus to the/etc/init. d directory.
Root @ ubuntu1110:/etc/init. d # CP $ nexus_home/bin/JSW/linux-x86-64/nexus ./
Add several variables to the nexus script
Nexus_home =/usr/nexus
Run_as_user = root
Platform = linux-x86-64
If you are not using the built-in JRE, add it.
# Java_home =/usr/jdk1.6.0 _ 30
# Path = "$ java_home/bin: $ path
Modify the values of several variables:
# Wrapper
Wrapper_cmd = $ nexus_home/bin/JSW/$ platform/wrapper
Wrapper_conf = $ nexus_home/bin/JSW/CONF/wrapper. conf
# location of the PID file.
piddir =/var/run
The modified script should be properly saved. It is boring to do this kind of thing again.
Run the following command:
Root @ ubuntu1110:/etc/init. d # update-rc.d nexus ults
Update-rc.d: Warning:/etc/init. d/nexus missing LSB Information
Update-rc.d: see http://wiki.debian.org/LSBInitScripts
Adding system startup for/etc/init. d/nexus...
/Etc/rc0.d/k20nexus-> ../init. d/nexus
/Etc/rc1.d/k20nexus-> ../init. d/nexus
/Etc/rc6.d/k20nexus-> ../init. d/nexus
/Etc/rc2.d/s20nexus-> ../init. d/nexus
/Etc/rc3.d/s20nexus-> ../init. d/nexus
/Etc/rc4.d/s20nexus-> ../init. d/nexus
/Etc/rc5.d/s20nexus-> ../init. d/nexus
OK. Now you can start it through service nexus start,
Then check the startup status through tail-F/usr/nexus/logs/wrapper. log.