Atlantic.Net Blog

How to Install ownCloud on Ubuntu 14.04

Arnaldo Arrieta July 9, 2015 by under Cloud Hosting 0 Comments

Introduction

ownCloud is a software system that provides file storage, synchronization, and sharing services. It can be compared to products such as Dropbox or Google Drive, with the advantage that it is a free and open source solution you can install and manage yourself.

With ownCloud, it is possible to share files and folders on a local computer and have them synchronized with your server.

Using the ownCloud Desktop Client (not covered in this guide), you can keep your files in sync across several devices, including smartphones and tablets. Or, you can use a browser to access your files from any computer connected to the web.

This guide will show you how to install ownCloud and modify some configuration settings.

We will use “example.com” in this guide. Replace it with the domain name or IP address you have configured on your server.

Read More


How to SSH into your Linux Server from Windows

Atlantic.Net NOC July 8, 2015 by under Cloud Hosting 0 Comments
Verified and Tested 03/22/2015

Introduction

In this how-to we will walk you through on How-To SSH into your Linux Server from Windows. SSH is a cryptographic network protocol that was made to replace telnet and allows local computer to authenticate with a remote server.

Prerequisites

A Linux server with SSH running and open. If you do not have a server, visit Atlantic.Net’s Cloud Hosting page and fire up a new server in under 30 seconds.

How to SSH into your Linux Server from a Windows Computer.

The first step, is you will need to download an SSH client. There are many out there but in this tutorial, we will use PuTTY which is a free SSH and telnet client for Windows. You can download it here.

Once you have an SSH client downloaded, open it. You will be prompted to enter the Hostname or IP address of your Linux server.

anet-How to SSH into your Linux Server from Windows

Putty Main Screen

Once you have the IP address, or hostname entered, click on OK.

You will then be prompted to enter the Username and Password to enter the server. The Password will not show as you type for security reasons.

anet-How to SSH into your Linux Server from Windows

Main Server login

Once you have completed, hit Enter, and you will be logged in!

Thank you for following along in this tutorial, please check back for more updates and to see our lineup of web hosting solutions.



How to: Managing System Logs with Journalctl

Chelsea Fieler July 7, 2015 by under Cloud Hosting 0 Comments

Introduction

In some of the newer Linux distributions, “init.d” or “rsyslogd” has been replaced by a program called JournalCTL.  Previously, logs were typically found in a particular location for each separate log file, rather than being easy to locate, manage, and manipulate.  Systemd made these log files easier to access by centralizing them, logging all kernel and user processes in one “journal.”  Journalctl is the newest version of this, which makes it even easier to manage these files.

In this guide, we will explain the basics of journalctl as well as a brief overview of suggested uses for the program.

Prerequisites

Must have a Linux distribution with journalctl as the system log management program, for example, CentOS 7.  If you do not have a server, consider a super fast SSD cloud server from Atlantic.Net.

Read More


How to Install WordPress on a Nginx LEMP Stack Using Ubuntu 14.04

WordPress Illustration by Walker Cahall

WordPress Illustration by Walker Cahall

Verified and Tested 07/3/15

Introduction

This how-to will show you how to install Nginx, MySQL, PHP and WordPress on an Ubuntu 14.04 cloud server. LEMP is a web service stack that consists of a Linux operating system, Nginx (pronounced “engine-x”) as the web server, MySQL for database management, and PHP as the programming language. WordPress is a content management system that is free and open source.

Prerequisites

A server with Ubuntu 14.04 installed.

Install WordPress on an Nginx LEMP Stack Using Ubuntu 14.04

First we want to make sure that your server is up to date by running the commands:

sudo apt-get update
sudo apt-get upgrade

Note: Depending on your installation you may need to remove apache2. You can do that by running the commands:

sudo apt-get remove apache2*

Followed by:

sudo apt-get autoremove

Installing Nginx on Ubuntu 14.04

To install Nginx, use the command:

sudo apt-get install nginx

When it asks, “Do you want to continue?”, hit Enter.

Start the Nginx service with the following command:

sudo service nginx start

We can now test Nginx by going to your hostname or IP address in your browser’s address bar. If you do not know your server’s IP address, you can run the following command:

ifconfig

You should get a result similar to the image below.

An example of ifconfig showing the IP address of 192.168.0.192

An example of ifconfig showing the IP address of 192.168.0.192

In our example, 192.168.0.192 is the IP address. So in our browser we would go to http://192.168.0.192.

You should see a web page that looks like the image below.

This example is the default Nginx web page on Ubuntu 14.04

This example is the default Nginx web page on Ubuntu 14.04

Now that Nginx is installed, we can move on to installing MySQL.

Installing MySQL on Ubuntu 14.04

Install MySQL with the command:

sudo apt-get install mysql-server

When it asks, “Do you want to continue?”, hit Enter.

Shortly after, a screen similar to the image below will appear.  You need enter a password for your MySQL root user. It should be a strong password.

Insert your secure password for your new MySQL root password

Insert your secure password for your new MySQL root password

Hit Enter to continue. Once you have hit Enter, a new screen will appear prompting you to re-enter the password you just picked.

Retype your MySQL password

Retype your MySQL password

Now that MySQL is installed, we need to do the MySQL secure installation by running the command:

sudo mysql_secure_installation

Enter your MySQL root password. When it asks, “Change the root password?”, type “N” followed by Enter. The rest of the questions are up to you. For standard installations, you can hit Enter for the defaults.

An example of the MySQL secure installation

An example of the MySQL secure installation

Now that MySQL is installed, we can install PHP.

Installing PHP on Ubuntu 14.04

Install PHP with the following command:

sudo apt-get install php5 php5-fpm php5-mysql

When it asks, “Do you want to continue?”, hit Enter.

For Nginx to work with PHP correctly, we need to edit the Nginx configuration file. In this how-to, we are going to use a simple Nginx configuration.

First, we need to move the original configuration file to a new filename. Run the command:

sudo mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.old

Using a text editor of your choice, we are going to make a file called default in /etc/nginx/sites-available. For nano use the command:

sudo nano /etc/nginx/sites-available/default

Copy the following into your text editor:

server {
        listen       80;
        server_name  your_site_name.com;
        root /usr/share/nginx/html;
        index index.php index.html;

        location / {
                try_files $uri $uri/ =404;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;

        location = /50x.html {
                root /var/www/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

In nano, to exit and save, hit Ctrl+x, type “y”, and then Enter.

Since we made changes to the configuration file, we need to restart Nginx, by running the command:

sudo service nginx restart

We are now going to create a simple PHP page to test.

Using a text editor of your choice, we are going create a file called info.php in /usr/share/nginx/html/.

sudo nano /usr/share/nginx/html/info.php

Copy the following into your text editor.

<?php
phpinfo();
?>

In your browser, you can go to http://Your-Hostname/info.php or http://Your-IP-Address/info.php. As above, in this example, we would use http://192.168.0.192/info.php.

You should see a web page similar to the one below.

An example of the info.php web page

An example of the info.php web page

Once you are done testing, it is a good idea to remove the info.php file since it may give a potential attacker information that can be used to craft a particular attack against your server. To do that run the command:

sudo rm /usr/share/nginx/html/info.php

Also, we can remove the default index.html file with the following command:

sudo rm /usr/share/nginx/html/index/html

Now that LEMP is installed, we can install WordPress

Setting up the MySQL database for WordPress on Ubuntu 14.04

We are going to start off by setting up the MySQL database by running the following commands:

sudo mysql -u root -p

When prompted, enter your MySQL root password that you set up when installing MySQL.

In MySQL, enter the following commands:

create database wordpress character set utf8 collate utf8_bin;

Make sure you set a secure password where it says [insert-password-here]:

grant all privileges on wordpress.* to [email protected] identified by "[insert-password-here]";
flush privileges;
exit

Get the Latest WordPress Install on Ubuntu 14.04

Now that the database is created, we can download the latest version of WordPress with the following command:

sudo wget http://wordpress.org/latest.tar.gz

The latest package will download to the directory that you are currently in, with the file name latest.tar.gz. We need to decompress the file by running:

sudo tar -xzvf latest.tar.gz

Configure WordPress on Ubuntu 14.04

Next, we need to copy wp-config-sample.php to wp-config.php, which is where WordPress gets its base configuration. To do that, run:

sudo cp wordpress/wp-config-sample.php wordpress/wp-config.php

In your favorite text editor, edit wordpress/wp-config.php.

sudo nano wordpress/wp-config.php

For a basic setup, we need to have the following.

define(‘DB_NAME’, ‘wordpress’);

define(‘DB_USER’, ‘wordpressuser’);

define(‘DB_PASSWORD’, ‘[insert-password-here]’);

It should look like this when completed:

What wp-config.php should look like once you have edited it

What wp-config.php should look like once you have edited it

Next, we need to move the WordPress folder to your web directory.

sudo cp -r wordpress/* /usr/share/nginx/html

Note: Your web directory may be different based on your configuration.

Finish Up Through The WordPress Web Installation.

Now, we can go to the WordPress web installation by entering your hostname or IP address in your browser’s address bar.

An example of the WordPress web installation

An example of the WordPress web installation

From here, all that is needed to do is to follow along with the WordPress install and give the information required.

Congratulations! You have just installed WordPress on an Nginx LEMP stack using Ubuntu 14.04. Check back for more updates. For more information on WordPress, you may want to check out the WordPress Codex.

Atlantic.Net

Atlantic.net offers managed hosting services which include a layer of business-essential managed services to your hosting packages. Contact us today for more information.


How to Install LEMP (Linux, Nginx, MySQL, PHP) on a Ubuntu 14.04 LTS Cloud Server

Brendan Bonner July 3, 2015 by under Cloud Hosting 0 Comments
NGINX Car by Walker Cahall

NGINX Car by Walker Cahall

Verified and Tested 07/3/15

Introduction

This how-to will show you how to install LEMP on a Ubuntu 14.04 cloud server. LEMP is a web service stack that consists of a Linux operating system, Nginx (pronounced “engine-x”), MySQL, and PHP. The main difference between LAMP and LEMP is that LAMP uses Apache, and LEMP uses Nginx. LEMP has been gaining popularity in the last few years because it excels in speed and scalability.

Prerequisites

A server with Ubuntu 14.04 installed.  If you do not have a server, Atlantic.Net has industry-leading SSD cloud servers for any business solution.

Installing LEMP on a Ubuntu 14.04  Cloud Server

First we want to make sure that your server is up to date by running the commands:

sudo apt-get update
sudo apt-get upgrade

Note: Depending on your installation you may need to remove apache2. You can do that by running the commands:

sudo apt-get remove apache2*

Followed by:

sudo apt-get autoremove

 

Installing Nginx on Ubuntu 14.04

To install Nginx, use the command:

sudo apt-get install nginx

When it asks “Do you want to continue?”, hit Enter.

Start the Nginx service with the following command:

sudo service nginx start

We can now test Nginx by going to your hostname or IP address in your browser’s address bar. If you do not know your server’s IP address, you can run the following command:

ifconfig

You should get a result similar to the image below.

An example of ifconfig showing the IP address of 192.168.0.192

An example of ifconfig showing the IP address of 192.168.0.192

In our example, 192.168.0.192 is the IP address. So in our browser we would go to http://192.168.0.192.

You should see a web page that looks like the image below.

This example is the default nginx web page on Ubuntu 14.04

This example is the default nginx web page on Ubuntu 14.04

Now that Nginx is installed, we can move on to installing MySQL.

Installing MySQL on Ubuntu 14.04

Install MySQL with the command:

sudo apt-get install mysql-server

When it asks “Do you want to continue?”, hit Enter.

Shortly after, a screen similar to the image below will appear.  You need enter a password for your MySQL root user. It should be a strong password.

Insert your secure password for your new MySQL root password

Insert your secure password for your new MySQL root password

Hit enter to continue. Once you have hit enter, a new screen will appear prompting you to re-enter the password you just picked.

Retype your MySQL password

Retype your MySQL password

Now that MySQL is installed we need to do the MySQL secure installation by running the command:

sudo mysql_secure_installation

Enter your MySQL root password. When it asks “Change the root password?”, type “N” followed by Enter. The rest of the questions are up to you. For standard installations, you can hit Enter for the defaults.

An example of the MySQL secure installation

An example of the MySQL secure installation

Now that MySQL is installed, we can now install PHP.

Installing PHP on Ubuntu 14.04

Install PHP with the following command:

sudo apt-get install php5 php5-fpm php5-mysql

When it asks “Do you want to continue?”, hit Enter.

For Nginx to work with PHP correctly, we need to edit an Nginx configuration file. In this how-to, we are going to use a simple Nginx config file.

First, we need to move the original configuration file to a new file name. Run the command:

sudo mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.old

Using a text editor of your choice, we are going to make a file called default in /etc/nginx/sites-available. For nano use the command:

sudo nano /etc/nginx/sites-available/default

Copy the following into your text editor:

server {
        listen       80;
        server_name  your_site_name.com;
        root /usr/share/nginx/html;
        index index.php index.html;

        location / {
                try_files $uri $uri/ =404;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;

        location = /50x.html {
                root /var/www/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

In nano, to exit and save, hit Ctrl+x , type “y”, and then Enter.

Since we made changes to the configuration file, we need to restart Nginx, by running the command:


sudo service nginx restart

We are now going to make a simple PHP page to test.

Using a text editor of your choice, we are going create a file called info.php in /usr/share/nginx/html/.

sudo nano /usr/share/nginx/html/info.php

Copy the following into your text editor.

<?php
phpinfo();
?>

In your browser, you can go to http://Your-Hostname/info.php or http://Your-IP-Address/info.php. As above, in this example, we would use http://192.168.0.192/info.php.

You should see a web page similar to the one below.

An example of the info.php web page

An example of the info.php web page

Once you are done testing, it is a good idea to remove the info.php file, since it may give a potential attacker information that can be used to craft a specific attack against your server. To do that run the command:

sudo rm /usr/share/nginx/html/info.php

Congratulations, you have installed LEMP on Ubuntu 14.04. Thank you for following this how-to. Please check back for more updates, to purchase a cost-effective cloud server, or take a look at our how-to on Installing WordPress on Ubuntu 14.04!


How to Install phpMyAdmin on a CentOS 7 Cloud Server

Brendan Bonner July 2, 2015 by under Cloud Hosting 0 Comments
phpMyAdmin Ship Illustration by Walker Cahall

phpMyAdmin Ship Illustration by Walker Cahall

Verified and Tested 07/2/15

Introduction

This how-to will walk you through the installation process of phpMyAdmin. phpMyAdmin is a tool to directly manage your databases by allowing you to visually add, delete, or modify databases and tables, among other things. phpMyAdmin is written in PHP and is free and open source.

Prerequisites

A CentOS 7 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.

You will need valid MariaDB credentials to log into your database once phpMyAdmin is installed.

This how-to assumes you are using a user with root privileges. You do not have to append sudo to the commands below if you are logged in as the root user.

Install phpMyAdmin on CentOS 7

To install phpMyAdmin quickly on CentOS 7, we are going to install the Extra Packages for Enterprise Linux (EPEL) repo first by running the following command:

sudo yum install epel-release

During the install, it will prompt “Is this ok?”. Hit “Y” and then Enter.

Now we can install phpMyAdmin.

sudo yum install phpmyadmin

During the phpMyAdmin install, it will prompt “Is this ok?” for the install and then the EPEL key. Hit “Y” and then Enter for each question.

The phpMyAdmin installation process will make a configuration file in /etc/httpd/conf.d/ called phpMyAdmin.conf. By default, phpMyAdmin is configured only to accept connections from the server it is installed on. If you want to allow other IPs, you’ll need to open the phpMyAdmin.conf file with your preferred text editor.

sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

In this example, we are using Apache 2.4, so we only need to change the configurations for 2.4. There will be two places that say “Require ip 127.0.0.1”. Below each one we are going to put “Require ip {your-public-IP}” For the purpose of this example, we’ll say we want to grant phpMyAdmin access to a workstation with an IP of 192.168.0.2. In this case, we would put “Require ip 192.168.0.2” below “Require ip 127.0.0.1” If you do not know your public IP, you can use this tool.

The configuration file should like the one below when completed.

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
        Require ip 127.0.0.1
        Require ip 192.168.0.2
        Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
        Require ip 127.0.0.1
        Require ip 192.168.0.2
        Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

In Nano to save a close, hit Ctrl+X and then Y and then Enter.

Note: When adding allowed IPs to this file, be sure you only add the IPs for users who require access. The more access you allow, you more you may also increase your server’s exposure to exploit.

Now, we can restart Apache so that the changes take place:

sudo systemctl restart httpd.service

To get to the login page, you need open your browser and go to http://{your-server's-address}/phpMyAdmin/. You should get a page that looks like the image below.

An example of the phpMyAdmin login page

An example of the phpMyAdmin login page

Note: If you do not know your IP address, run the following command:

ip addr show eth0
An example of running the command: ip addr show eth0 and getting 192.168.100.10 for the IP address.

An example of running the command: ip addr show eth0 and getting 192.168.100.10 for the IP address.

In our example we would put http://192.168.100.10/phpMyAdmin/ into our browser’s address bar.

You can sign in with the root MariaDB credentials that you set-up when installing LAMP. Once logged in, you should get a page similar to the one below.

An example of the phpMyAdmin default page.

An example of the phpMyAdmin default page.

Using this interface, you can now easily manage your databases on your CentOS 7 LAMP server.

Congratulations! You have just installed phpMyAdmin on your CentOS 7 Cloud Server. Thank you for following along in this How-To! Check back with us for any new updates, and try our line of cloud hosting solutions.


How to Generate a Certificate Signing Request (CSR) for an SSL

Verified and Tested 03/26/17

Introduction

This article will explain how to generate a Certificate Signing Request (CSR). You will be required to submit a CSR when obtaining an SSL/TLS certificate from a certificate authority (CA).

Prerequisites

Any Linux distribution with OpenSSL installed. If you do not have a server, why not consider a Linux Cloud Server from Atlantic.Net and be up and running in under 30 seconds.

Generate a Certificate Signing Request (CSR)

Both the CSR and the private key for your server can be generated in one easy step. Be sure to keep access to your private key as restricted as possible, as this unique identifier is used to verify the authenticity of your server.

Note: If you are having trouble running the command successfully, you may need to log in as sudo or root.

openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr

You will then be asked for the following information:

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Note: The challenge password is not related to the private key password. Leave it blank unless required by your certificate authority. You may also leave the “optional company name” question blank.


You now have the “.csr” (Certificate Signing Request) file that will need to be submitted to a certificate authority (CA). Once the CA has signed the certificate, it will return a certificate file. The format of the issued certificate will vary depending on the certificate authority.  The most common type will be PEM format which utilize extensions such as .crt.key.csr.cer, and .pem.


Depending on the needs of your application or web server, you may need to convert one of these formats to other formats such as PKCS#7, PKCS#12, or DER. Here are a some useful file conversion commands:

PEM → PKCS#7 (P7B)

openssl crl2pkcs7 -nocrl -certfile yourdomain.cer -out yourdomain.p7b -certfile CACert.cer

The -nocrl option indicates that you will not be including a certificate revocation list (CRL) in the PKCS#7 structure. Most new deployments will use this option, since there will be no older certificates to revoke.
Each -certfile option indicates a certificate file that will be included in the output file, which is useful in creating a certificate chain including the server certificate and the certificate authority’s intermediate certificate (“yourdomain.cer” and “CACert.cer”, respectively, in the example above).
The -out option indicates the file name to write the PKCS#7 output to.

PEM → PKCS#12 (PFX)

openssl pkcs12 -export -out yourdomain.pfx -inkey yourdomain.key -in yourdomain.crt -certfile CACert.crt

The -export option indicates that this command will create a PKCS#12 file. The default behavior without the -export option is to parse the input.
The -in option indicates the PEM-formatted file to be read from. If this file doesn’t also include the private key, you will need the -inkey option to indicate the private key file, as well.
The -certfile option indicates additional certificates to include in the PKCS#12 file, such as intermediate certificates.
The -out option indicates the file to write the output to, usually a “.pfx” file.

PEM → DER

openssl x509 -outform der -in yourdomain.pem -out yourdomain.der

The -in option indicates the input certificate file to be converted.
The -out option indicates the output file name.
The -outform option indicates the file format for the output (in this example, the input file is in the PEM format, and this command would take that file and create a DER-formatted file).


How to do a Tomcat to Tomcat SSL Transfer on CentOS

Jason Mazzota June 30, 2015 by under Cloud Hosting 0 Comments
Verified and Tested 03/24/2015

Introduction

In this tutorial, we will be going over a basic way on how to transfer your SSL from one CentOS 6 x86_64 server running Tomcat to another CentOS 6 x86_64 server running Tomcat. This has been tested on Java 6 and Tomcat 6 as well as Java 8 and Tomcat 8. For the ease of this tutorial, the original server with the SSL will be Server A. The new server that we are transferring to will be Server B.

Prerequisites

You will need two servers with CentOS 6 x86_64 installed and both servers need to have Java and Tomcat installed. One of the servers has to have an SSL already installed onto it. If you do not have a new CentOS server, you can get a Cloud Server from Atlantic.Net.

Tomcat to Tomcat SSL Transfer on CentOS

The easiest way to transfer your certificate between servers is going to be to create a pkcs12 file out of it. Assuming you have the .pem of your certificate, this can be quite easy. If you do not have the .pem, you will need to create one. You can see the Creating a pem for your SSL page for this.

You can copy your key file that you generated for the SSL originally into a separate key.pem if it is not a .pem already. In our example, we have done this and have also stripped out the password for the key. To do this, you may view the How to Remove the Password From Your SSL Key page.

We are now ready to export the SSL to a .pkcs12 file. To do this, on Server A you just run:

openssl pkcs12 –export –name NAME –in certificate.pem –inkey key.pem –out keystore.p12

The keystore.p12 will ask you for a password, please use a secure password you will remember. For NAME, you will want to use a name you will not forget. It would be best practice to simply use your domain name without the .tld (so no .com, .org, etc.) The certificate.pem would be the SSL .pem file you have or just created. The key.pem would be your SSL key in .pem format and they keystore.p12 is what we will be transferring to the new server. You can name all these files as you please, just make sure you are keeping track of them.

Now you may transfer the keystore.p12 to Server B using whatever method you would like. In our example, we use rsync.

rsync keystore.p12 [email protected]_of_Server_B:/directory/to/copy/to

Once copied, you can move the keystore.p12 to your SSL directory of Server B if you did not copy it there to begin with. We will now want to load the keystore.p12 with java’s keytool on Server B.

/path/to/java/keytool –importkeystore –destkeystore /path/to/ssl/directory/keystore.jks –srckeystore /path/to/ssl/directory/keystore.p12 –srcstoretype pkcs12 –alias NAME

It should prompt for a new password for the keystore (you may use the same password or create a new one) and the password you created for keystore.p12. NAME should be the same NAME you utilized in the keystore.p12 generation.

Once this keystore is created, the hard work is done. To finish this off you just need to edit the Tomcat server.xml on Server B to use this keystore.jks and the passphrase and you will be good to go.

Inside the Tomcat server.xml you will want to find the section with: “<Connector port=”8443“.” This is where we would uncomment (remove the “<!–“ and “–>” that section is surrounded in) and add in at the end (before “/>”):

keystoreFile=”/path/to/keystore.jks” keystorePass="PASSWORD"

Where keystore.jks is the keystore.jks we made and the PASSWORD is the password you created for the keystore. After this is added, you can restart Tomcat, and your SSL will be in use for Tomcat.

anet-tomcat_to_tomcat_ssl-00

An example of a tomcat config with the new SSL

You will need further configuration for 8443 to be in use but the SSL will be transferred and if you log into your manager for Tomcat and check the SSL configuration, you should see that SSLs for 8443 are enabled.


How to: Basic Bash Administration Tools On Linux (df, fdisk, top, free, iostat, ifconfig, sensors, stat, nmap, and netstat)

Andrew Mora June 29, 2015 by under Cloud Hosting 0 Comments
Verified and Tested 02/26/15

Introduction

This tutorial is a brief rundown of the BASH shell commands and tools that come in handy for the Linux administrator. Focus more on tools for administration, as opposed to the basic usage of Linux based Operating Systems. While this article is being written in the context of distros based on RHEL 4+ and Debian 6+, many of these commands may also be found on BSD, FreeBSD, any other Unix systems. Depending on your Operating system, each command’s flags may differ, or may no exist for the respective Operating System.

Prerequisites

RHEL 4+ and Debian 6+ based Operating Systems, including CentOS and Ubuntu. If you do not have a server, you can start up a reliable Linux server from Atlantic.Net in under 30 seconds.

Basic Bash Administration Tools

I will be providing a Need, coupled with the BASH command that can satisfy this need. Keep in mind that each command may have several many more functions and command line options available than the examples I’ll be showing below. I’ll be sticking to the basic commands that attain the bare minimum output you desire. I encourage all of you read the Manual page for each command.

I need to:

Find out how much hard drive space I have left| Command: df

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        79G  2.2G   73G   3% /
tmpfs           939M     0  939M   0% /dev/shm

List my available hard drives| Command: fdisk

# fdisk -l

Disk /dev/sda: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00015f65

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       10444    83884032+  83  Linux

View my systems resources(running tasks, CPU utilization)| Command: top

# top
top - 10:44:56 up 101 days, 25 min,  1 user,  load average: 0.00, 0.01, 0.00
Tasks:  99 total,   1 running,  98 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.1%us,  0.0%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1922380k total,  1627448k used,   294932k free,   164252k buffers
Swap:        0k total,        0k used,        0k free,  1267812k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 8655 root      20   0 15032 1068  808 R  2.0  0.1   0:00.01 top
    1 root      20   0 19232 1420 1140 S  0.0  0.1   0:35.85 init
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT   0     0    0    0 S  0.0  0.0   0:02.20 migration/0
    4 root      20   0     0    0    0 S  0.0  0.0   0:02.05 ksoftirqd/0
    5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0
    6 root      RT   0     0    0    0 S  0.0  0.0   0:20.04 watchdog/0

View my systems memory utilization| Command: free

# free -m
             total       used       free     shared    buffers     cached
Mem:          1877       1589        288          0        160       1238
-/+ buffers/cache:        190       1686
Swap:            0          0          0

View my systems disk activity| Command: iostat

# iostat 2
Linux 2.6.32-431.el6.x86_64 (nginxs)    05/11/2015      _x86_64_        (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.11    0.00    0.05    0.02    0.00   99.83

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               0.54         0.10        35.16     863199  306833368

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.00    0.00    0.25    0.25    0.00   98.50

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               5.00         0.00        88.00          0        176

View my network interfaces and IP’s| Command: ifconfig

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:D1:D0:61:AF
          inet addr:209.208.xx.xxx  Bcast:209.208.xx.xxx  Mask:255.255.255.0        
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6414823 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6864133 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1325544537 (1.2 GiB)  TX bytes:1155254908 (1.0 GiB)

eth1      Link encap:Ethernet  HWaddr 00:00:0A:D0:61:AF
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:296071 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:13464542 (12.8 MiB)  TX bytes:398 (398.0 b)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:9813 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9813 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:775658 (757.4 KiB)  TX bytes:775658 (757.4 KiB)

View my hardware’s temperature readings| Command: sensors

# sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0:      +39.0°C  (high = +76.0°C, crit = +100.0°C)

coretemp-isa-0001
Adapter: ISA adapter
Core 1:      +39.0°C  (high = +76.0°C, crit = +100.0°C)

it8718-isa-0290
Adapter: ISA adapter
in0:         +1.07 V  (min =  +0.00 V, max =  +4.08 V)
in1:         +1.92 V  (min =  +0.00 V, max =  +4.08 V)
in2:         +3.31 V  (min =  +0.00 V, max =  +4.08 V)
in3:         +2.91 V  (min =  +0.00 V, max =  +4.08 V)
in4:         +0.34 V  (min =  +0.00 V, max =  +2.10 V)
in5:         +4.08 V  (min =  +0.00 V, max =  +4.08 V)   ALARM
in6:         +4.08 V  (min =  +0.00 V, max =  +4.08 V)   ALARM
in7:         +3.15 V  (min =  +0.00 V, max =  +4.08 V)
Vbat:        +3.25 V
fan1:       1231 RPM  (min =    0 RPM)
fan2:       1268 RPM  (min =    0 RPM)
temp1:       -55.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermistor
temp2:        -2.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermistor
temp3:       +20.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermal diode

Get permission level of a file/directory| Command: stat

# stat -c '%a' /home/testfile.txt
644

Find what ports are open on a remote/local host| Command: nmap

NOTE: You’ll likely have to install the nmap package from your YUM/APT package manager.

# nmap -p- localhost

Starting Nmap 5.51 ( http://nmap.org ) at 2015-05-11 11:07 EDT
Failed to find device eth1 which was referenced in /proc/net/route
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000011s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 65528 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
25/tcp   open  smtp
80/tcp   open  http
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds
9000/tcp open  cslistener

Nmap done: 1 IP address (1 host up) scanned in 1.52 seconds

Find out what ports my server is listening on| Command: netstat

# netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      5573/smbd
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      29209/nginx
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      3557/vsftpd
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      18608/sshd
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      9400/master
tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      5573/smbd
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      28996/php-fpm
tcp        0      0 :::139                      :::*                        LISTEN      5573/smbd
tcp        0      0 :::22                       :::*                        LISTEN      18608/sshd
tcp        0      0 ::1:25                      :::*                        LISTEN      9400/master
tcp        0      0 :::445                      :::*                        LISTEN      5573/smbd
udp        0      0 209.208.x.x:137          0.0.0.0:*                               5592/nmbd
udp        0      0 209.208.x.x:137          0.0.0.0:*                               5592/nmbd
udp        0      0 0.0.0.0:137                 0.0.0.0:*                               5592/nmbd
udp        0      0 209.208.x.x:138          0.0.0.0:*                               5592/nmbd
udp        0      0 209.208.x.x:138          0.0.0.0:*                               5592/nmbd
udp        0      0 0.0.0.0:138                 0.0.0.0:*                               5592/nmbd
udp        0      0 0.0.0.0:1194                0.0.0.0:*                               12988/openvpn

Thank you for following along this guide on Basic Bash Administration Tools, I hope that you enjoyed this guide, please check back for more updates.


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources

We use cookies for advertising, social media and analytics purposes. Read about how we use cookies in our updated Privacy Policy. If you continue to use this site, you consent to our use of cookies and our Privacy Policy.