Linux Installation
Last updated
Last updated
Login as root in the linux environment
Download the JDK 8(jdk-8u361-linux-x64.tar.gz) from this official site:
Open the terminal and enter the following command to create the parent directory to deploy the JDK.
sudo mkdir /usr/lib/jvm
Enter the following command to change the directory cd /usr/lib/jvm
Extract the jdk-8u361-linux-x64.tar.gz file in the jvm directory using this command
sudo tar -xvzf /YourHomeDirectory/jdk-8u361-linux-x64.tar.gz
Enter the following command to open the environment variables file. According to your personal preference, you can choose any text editor instead of nano. sudo nano /etc/environment
In the opened file, add the following bin folders to the existing PATH variable. Note that the PATH variables must be separated by a colon.
/usr/lib/jvm/jdk1.8.0_361/bin
/usr/lib/jvm/jdk1.8.0_361/db/bin
/usr/lib/jvm/jdk1.8.0_361/jre/bin
Append the following environment variable to the end of the file.
A sample environment file before making these changes would look like the following:
The same file after making the changes should look like this:
Save the changes and close the editor
Sometimes an existing JDK installation might have a shortcut added to the /usr/bin directory. Therefore setting the PATH environment variable alone may not change the default Java compiler and runtime. To update these alternative shortcuts, run the following commands:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_351/bin/java" 0sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_351/bin/javac" 0sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_351/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_351/bin/javac
To verify the setup enter the following commands and make sure that they print the location of java and javac as you have provided in the previous step.
update-alternatives --list java
update-alternatives --list javac
Test version on terminal with command
java -version
If you are not able to see the version install missing linux libraries
sudo apt-get install libc6-i386
Tomcat installation will require java which were previously installed as shown above
sudo apt update
Set up a Tomcat user sudo useradd -r -m -U -d /opt/tomcat -s /bin/false tomcat
Download tomcat
wget -c https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.109/bin/apache-tomcat-7.0.109.tar.gz
4. Install on linux sudo tar xf apache-tomcat-7.0.109.tar.gz -C /opt
5. Rename apache-tomcat-7.0.109 to tomcat
cd /opt
mv apache-tomcat-7.0.109 tomcat
Now we need to provide the user Tomcat with access for the Tomcat installation directory
sudo chown -R tomcat: /opt/tomcat/*
Finally, we will use the chmod command to provide all executable flags to all scripts within the bin directory.
sudo sh -c 'chmod +x /opt/tomcat/bin/*.sh'
Configure Tomcat serice sudo nano /etc/systemd/system/tomcat.service
Now enter the following in your file and save it. Note that you need to update the value of JAVA_HOME if your Java installation directory is not the same as given below.
Now we reload the daemon to update the system about the new file.
sudo systemctl daemon-reload
Start tomcat service sudo systemctl start tomcat
Now we can enable the Tomcat service to run on startup using this command. sudo systemctl enable tomcat
After you install Tomcat, you need to allow it to use the 8080 port through the firewall to be able to communicate outside your local network. sudo ufw allow 8080/tcp
Once we install Tomcat on Linux, we need to verify our installation. To do so, simply enter the following in your browser.
http://YourIPAddress:8080
To enable tomcat to write in /var/lib , create the OpenMRS folder and make tomcat to own it using the commands below
cd /var/lib
mkdir OpenMRS
sudo chown tomcat:tomcat OpenMRS/*
Done.
Guide for mysql installation is provided in link here Mysql Installation
Remember to create mysql user 'openmrs'
Stop tomcat service sudo service tomcat stop
copy war file to /opt/tomcat/webapps folder
Start tomcat service sudo service tomcat start
Access the system on browser via http://YourIPAddress:8080/openmrs
You should see OpenMRS Installation Wizard page as below
Select your preferred language and click the “=>” button.
On the Installation Type screen, choose the Advanced installation type you want and click the “=>” button.
Fill in your MySQL root password as shown below, and click the “=>” button.
Fill the Next form as shown below and click the “=>” button.
Fill in options as shown below and click the “=>” button.
Fill in admin password as shown below and click the “=>” button.
Skip next form click the “=>” button.
And continue to finish the installation
Drop openmrs database dump to openmrs database and restart tomcat service.
Done Click the “=>” button to create a database for OpenMRS and complete the installation. Log in to OpenMRS using the default username “admin” and password “Admin123”.
If your installation and configuration were successful, you should see this page.