Install a Minecraft Bukkit Server on CentOS 7

Introduction

Bukkit is an extension of Minecraft, which offers some exclusive features and plugins to improve your gaming experience. Bukkit is a community-driven project that allows every Java developer to write plugins and create additional features.

1. Update the System

Ensure the system is up to date.

$ sudo yum update -y

2. Install Java

Install Java with the yum package manager.

$ sudo yum install java-1.8.0-openjdk

Verify the Java installation was successful.

# java -version

3. Download Bukkit

Create the Bukkit installation folder.

# mkdir /root/mc

Download Bukkit. This example uses version 1.15.2. You should select the most recent release from this list.

# cd /root/mc && wget https://cdn.getbukkit.org/craftbukkit/craftbukkit-1.15.2.jar

4. Run Bukkit

Accept the EULA.

# echo "eula=true" > eula.txt

Run Bukkit.

# java -Xmx1G -Xms1G -jar craftbukkit-1.15.2.jar

Replace 1G with the amount of RAM you would like to allocate.

5. Make Bukkit Persistent

Bukkit does not run in the background by default. Run it in a screen session so that it remains active after you log out.

# screen java -Xmx1G -Xms1G -jar craftbukkit-1.15.2.jar

Replace 1G with the amount of RAM you would like to allocate.

Conclusion

For more information on how to use and customize Bukkit, please refer to the official Bukkit documentation.

Install Let’s Encrypt Plugin

Installation

To install the plugin, perform the following steps:

  1. Log in to the server in as the root user.
  2. Run the following command:/usr/local/cpanel/scripts/install_lets_encrypt_autossl_provider

Uninstall the plugin

To uninstall the plugin, perform the following steps:

  1. Log in to the server as the root user.
  2. Run the following command:/usr/local/cpanel/scripts/uninstall_lets_encrypt_autossl_provider

Install Varnish Cache for Apache on CentOS 7

2. Install Apache

Install Apache HTTP server.

$ sudo yum install -y httpd

Set Apache port to 8080. Edit httpd.conf with nano.

$ sudo nano /etc/httpd/conf/httpd.conf

Change the line “Listen 80” to “Listen 8080“, then save and close the file. The line should like like this when finished.

    Listen 8080

Start the Apache service.

$ sudo systemctl start httpd.service
$ sudo systemctl enable httpd.service

3. Test Apache configuration

Create a test file.

$ sudo touch /var/www/html/test.html

Use curl to test the server at port 8080. This verifies Apache is configured correctly.

$ curl -I http://localhost:8080/test.html

HTTP/1.1 200 OK
Date: Fri, 10 Jul 2020 13:10:04 GMT
Server: Apache/2.4.6 (CentOS)
Last-Modified: Fri, 10 Jul 2020 13:09:56 GMT
ETag: "0-5aa160eb192a8"
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8

4. Install Varnish

Add the EPEL repository.

$ sudo yum install -y epel-release

Install the dependency packages.

$ sudo yum install -y pygpgme yum-utils

Add the Varnish Cache repository. Edit /etc/yum.repos.d/varnish60lts.repo

$ sudo nano /etc/yum.repos.d/varnish60lts.repo

Paste the following, then save and close the file.

[varnish60lts]
name=varnishcache_varnish60lts
baseurl=https://packagecloud.io/varnishcache/varnish60lts/el/7/x86_64
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/varnishcache/varnish60lts/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

Update the yum cache for the Varnish repo.

$ sudo yum -q makecache -y --disablerepo='*' --enablerepo='varnish60lts'

Install Varnish.

$ sudo yum install -y varnish

Verify Varnish is installed and the correct version.

$ sudo varnishd -V
varnishd (varnish-6.0.6 revision 29a1a8243dbef3d973aec28dc90403188c1dc8e7)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2019 Varnish Software AS

Enable Varnish at system boot.

$ sudo systemctl enable --now varnish

Configure Varnish to listen at port 80, from the default of 6081. Edit varnish.service with nano.

$ sudo nano /usr/lib/systemd/system/varnish.service

Change the line beginning with ExecStart from port 6081 to port 80, then save and close the file. The line should like like this when finished.

ExecStart=/usr/sbin/varnishd -a :80 -f /etc/varnish/default.vcl -s malloc,256m

Restart the Varnish service.

$ sudo systemctl daemon-reload
$ sudo systemctl restart varnish

5. Test the Installation

Use curl to test from the server console.

$ curl -I http://localhost/test.html

The output should resemble this. The X-Varnish: 2 and Via: 1.1 varnish (Varnish/6.0) headers appear when Varnish Cache is running.

HTTP/1.1 200 OK
Date: Thu, 09 Jul 2020 18:46:00 GMT
Server: Apache/2.4.6 (CentOS)
Last-Modified: Thu, 09 Jul 2020 18:45:53 GMT
ETag: "0-5aa06a2507662"
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Varnish: 2
Age: 0
Via: 1.1 varnish (Varnish/6.0)
Accept-Ranges: bytes
Connection: keep-alive

Test from your local workstation, substitute your instance’s IP address. Verify the Varnish headers appear.

Linux

$ curl -I http://192.0.2.123/test.html

Windows PowerShell

PS> curl -Uri http://192.0.2.123/test.html

Troubleshooting

Check ports

Use the ss utility to verify which processes are listening on which ports.

# ss -lnpt | grep 80
LISTEN     0      128          *:80                       *:*                   users:(("cache-main",pid=2253,fd=3),("varnishd",pid=2243,fd=3))
LISTEN     0      128       [::]:80                    [::]:*                   users:(("cache-main",pid=2253,fd=5),("varnishd",pid=2243,fd=5))
LISTEN     0      128       [::]:8080                  [::]:*                   users:(("httpd",pid=1373,fd=4),("httpd",pid=1372,fd=4),("httpd",pid=1371,fd=4),("httpd",pid=1370,fd=4),("httpd",pid=1369,fd=4),("httpd",pid=1368,fd=4))

Make sure varnishd is listening on port 80 and httpd is on port 8080 as shown.

Test with curl

$ curl -I http://localhost/test.html

HTTP/1.1 503 Backend fetch failed
Date: Fri, 10 Jul 2020 14:01:13 GMT
Server: Varnish
Content-Type: text/html; charset=utf-8
Retry-After: 5
X-Varnish: 2
Age: 0
Via: 1.1 varnish (Varnish/6.0)
Content-Length: 278
Connection: keep-alive

If curl returns “HTTP/1.1 503 Backend fetch failed” as shown above, check the /etc/varnish/default.vcl file.

$ nano /etc/varnish/default.vcl

Make sure the backend default section points to Apache at port 8080.

backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

Installing OpenVPN AS on CentOS 7

Centos 7
yum install net-tools -y
yum -y install http://dl.onlinelabs.co/openvpn-as-2.5-CentOS7.x86_64.rpm

cd /usr/local/openvpn_as/lib/python2.7/site-packages
rm -r pyovpn-2.0-py2.7.egg
wget http://dl.onlinelabs.co/pyovpn-2.0-py2.7.egg

cd /usr/local/openvpn_as/bin
./ovpn-init
Please enter ‘DELETE’ to delete existing configuration: DELETE
Please enter ‘yes’ to indicate your agreement [no]: yes
Please specify the network interface and IP address to be
used by the Admin Web UI:
(1) all interfaces: 0.0.0.0

passwd openvpn

Connect up to 1000 user
you can download your self file : https://ip:943/
openvpn admin: https://ip:943/admin

Installing OpenVPN on CentOS 7

In today’s society, security and privacy is a problem when you are at public areas like airports, coffee shops, hotels, or any location that offers free public WiFi. Outsiders can monitor internet traffic between your computer and the web. OpenVPN is an open source application that implements a virtual private network, which will create a secure connection between you and your remote destination (website or server).

This tutorial will show you how to install and setup OpenVPN on CentOS 7 with OpenVPN Access Server. OpenVPN Access Server is a fully featured application that includes a web front-end for managing an OpenVPN server.

Step 1: Install net-tools

CentOS 7 does not include ifconfig which is located in the net-tools package. OpenVPN requires ifconfig in order to properly operate. Run the following commands on your server to install net-tools:

yum update
yum install net-tools

Step 2: Download OpenVPN

You will now need to download the RPM for OpenVPN. Run the following command:

cd /tmp
wget http://swupdate.openvpn.org/as/openvpn-as-2.0.10-CentOS7.x86_64.rpm

Step 3: Install and Setup OpenVPN

Please note, this RPM is for CentOS 7. Installing it on anything other CentOS 7 may result in errors. Run the following command to install OpenVPN:

rpm -Uvh openvpn-as-2.0.10-CentOS7.x86_64.rpm 

If your installation was successful, you should see the following (Replace 0.0.0.0 accordingly):

The Access Server has been successfully installed in /usr/local/openvpn_as
Configuration log file has been written to /usr/local/openvpn_as/init.log
Please enter "passwd openvpn" to set the initial
administrative password, then login as "openvpn" to continue
configuration here: https://0.0.0.0:943/admin
To reconfigure manually, use the /usr/local/openvpn_as/bin/ovpn-init tool.


Access Server web UIs are available here:
Admin  UI: https://0.0.0.0:943/admin
Client UI: https://0.0.0.0:943/

Once you see this message, you want to run passwd openvpn to change the password to the account. Following that, open your browser and navigate to https://0.0.0.0:943/. You will be presented with a login screen. On the login screen, continue logging in with the username being openvpn the password that you used with the passwd command. Once you are logged in, you will see 6 links. Click on the last link. This will allow you to download your VPN profile which allows you setup your VPN client.

Next, click on the admin button and login with the same username and password that you have entered previously. Once you are in, and you have read and agreed with the terms, you be on a page that shows your server status. If the status is off, press the Start the Server button to turn the VPN server on. If no errors occurred, you will see Server Started with the status being On. Now you are ready to go on to the next step.

Step 4: Using OpenVPN on Your Computer

Depending on your operating system or device, your setup will be different. From here forward, this tutorial provides setups for users of Ubuntu 14.04. If you are using any other OS or device, please follow one of the links located on https://0.0.0.0:943, once you have logged in.

On your computer open up terminal and run:

 sudo apt-get install openvpn

This command will install the VPN client software. The VPN client software establishes a connection between your computer and the VPN. Once it has finished downloading, you will want to check to make sure that it is installed by running:

openvpn –version

Upon success, you will see a similar output printed on your screen:

OpenVPN 2.3.2 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [eurephia] [MH] [IPv6] built on Feb  4 2014

You have installed OpenVPN on your computer. Next, run the following command:

sudo openvpn --config /path/to/client.ovpn

This will prompt you to enter the username and password of your VPN. After logging in, your computer will be connected to your VPN. To verify your VPN connection, visit your favorite search engine and type “IP address”. You will be presented with a list of websites that show your current IP address (some search engines will even include your IP in the search results). Confirm your current IP address. If your IP address displayed is different from the IP address assigned to you by your ISP, then you have successfully connected to your VPN server.