Wie können wir helfen?
Installing prerequisites and some useful utils
To install some pre-requisites useful software crucial for comfortable usage of your system, execute these commands:
yum install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64 mc net-tools.x86_64 htop iotop iftop unzip wget epel-release -y
yum install rlwrap -y
A few words about the packages installed:
java-1.8.0-openjdk.x86_64andjava-1.8.0-openjdk-devel.x86_64are Java 8 Development Kit packages, which are needed for Tomcat and ORDS to operate.
Installing Java from official repository usingyumshould set all the needed environment variables. But you can check it by executing the commandjava -versionand if it works, everything is ok. But if not, then correctly set the$PATHand$JAVA_HOMEvariables.
mc– Midnight Commander – a really powerful file manager similar to Norton Commander or FAR Manager.net-tools.x86_64– useful and customary network utilities such asifconfigandnetstat. The thing is in CentOS 7 they replaced these usual utilities withipandsscommands, so to be able to useifconfigit should be installed manually.htop– a very good alternative to standardtoputility. It is much more powerful and can be flexibly configured.iotop– input/output read/write monitoring utility. Very useful to check disk problems when using a database.iftop– an utility to monitor network bandwidth.unzip– unzip utility.wget– a command-line utility to fetch files from the remote source (HTTP or FTP-host for example).epel-release– an additional repository for CentOS with loads of useful software, called EPEL (stands for Extra Packages for Enterprise Linux).rlwrap– a command-line wrapper utility, irreplaceable thing when it comes to usesqlpluson Linux. Always userlwrap sqlplusinstead of justsqlplusto see the difference. These utils installs from EPEL repository.
Initial system configuration
Network Time Synchronisation
There’s an utility called chrony for this purpose in the minimal CentOS installation:
systemctl start chronyd
systemctl enable chronyd
Disabling SELinux on CentOS7
Now, we need to disable selinux. Its configuration and usage is a topic for a different series of blog posts, so here we’ll just omit all this.
Type this command:
mcedit /etc/sysconfig/selinux
Configuring the Firewall
CentOS 7 uses firewalld as a main firewall service, which is an additional abstraction level above iptables. In many other guides you could see people disabling it and returning to use iptables directly. I don’t know why, maybe because it always hard to pick up something new. And so, I tried, and really liked firewalld ease of configuration (especially in comparison to iptables if you’re new to it).
To configure the firewall, we are going to do these things:
- Add a new service called
oracle-db. - Set the new service description and add the port to it.
- Enable such services as
http,httpsandoracle-xefor the default zonepublic. - Reload firewall list of rules on-the-fly.
To do this all, execute the commands below:
firewall-cmd --permanent --new-service=oracle-db
firewall-cmd --permanent --service=oracle-db --set-short="Oracle Database Listener" --add-port=1521/tcp
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --permanent --zone=public --add-service=oracle-db
firewall-cmd --reload
Now we are ready to install the Apache Tomcat and httpd
Installing of Apache Tomcat and Apache httpd
To install both the application and the web server we will be using yum, because it is the safest and the easiest way I know so far. You’re still able to manually download and install them, but this is not the aim of this guide. Only one thing here – it is assumed that you have completed all the steps from above (installing JDK in particular) before proceeding with the installation.
So, in order to install Tomcat and httpd run this:
yum install tomcat httpd -y
This will install Tomcat 7 and Apache httpd 2.4 on your system. The 7th version of Tomcat is more than enough for us. Then, to start the services and to start them on startup, let’s do the next:
systemctl start tomcat
systemctl enable tomcat
systemctl start httpd
systemctl enable httpd
That’s it! By now both Tomcat and httpd should work on your system and should listen ports 8080 and 80 respectively on your server. Note the fact that we intentionally didn’t open port 8080 on our server, because we are not going to use it. Instead, httpd will reverse proxy all requests to Tomcat using AJP protocol listener on port 8009.
You even may disable the HTTP connector on port 8080 in Tomcat’s
server.xmlconfig (this is very optional). I will not tell you how to do this, consider it an exercise. Do not forget to restart the Tomcat service afterwards in case you already opened yourmcfile manager.