• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Your first open Linux ubuntu server

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,078
Solutions
15
Reaction score
370
Location
Sweden
YouTube
Joriku
This tutorial is aiming on Ubuntu 18.04
What you need:
Paid Host/Linux server
Recommended Options: (link removed due to advertisement).
Hetzner.com - hetasd (link removed due to advertisement).

Ovh.com/world - OVH Hosting Company (link removed due to advertisement).
Programs needed: (FileZilla works, but recommend WinSCP)
Putty - Download Putty (link removed due to advertisement).
WinSCP - Download WinSCP (link removed due to advertisement).

Server Files at the end of the tutorial (OTServBR 12.20 Linux comming soon)

Steps in the tutorial,

1. Install Apache
2. Install MySQL
3. Configure Firewall & MySQL Security

4. Install PHP
5. Encrypt SSL (Secured Website Traffic)

This is Encrypted Traffic/None encrypted Traffic

1b0fc5d594c7c002636016bf44116fae.png
638634bdec2e0658d527c6a3f1638f3d.png


Superuser Setup
example will be: john

add user john by typing:
Code:
sudo adduser john
Once you added the user, give it superuser privileges by typing:
Code:
sudo usermod -aG sudo john
Now switch over to the user by typing:
Code:
sudo su - john
Check server Timezone
First of all, let us see if the timezone is correct by typing:

Code:
date
If the date is correct you can skip this.
Now, let us change the timezone into your timezone by typing:

Code:
timedatectl list-timezones
(Press SPACE to page down, b to page up and once you find your Timezone press q to exit)
Find your timezone, example. Iam in Sweden so I'll be using Europe/Stockholm.
Update your Timezone by typing:

Code:
sudo timedatectl set-timezone YOUR_TIMEZONE
Now check if your Timezone is correct by typing:
Code:
date
Next step is to update Ubuntu, type:
Code:
sudo apt update && sudo apt upgrade && sudo apt dist-upgrade
Type Y and hit ENTER
Afther the installation is compleated reboot the server by typing:

Code:
sudo reboot
Close down Putty and reopen it and login with your created user. Example: john
Configure a Web Server
You now have two alternatives [Apache] & [Negix]
[Apache Guide]

Install Apache, Type:
Code:
sudo apt update && sudo apt install apache2
Now configure firewall, type:
Code:
sudo ufw allow OpenSSH
If you get an error “ERROR: could find a profile matching openSSH”, this probably means you are not configuring the server remotely and can ignore it.
Now add firewall rules for Apache, Type:
Code:
sudo ufw allow in "Apache Full"
Now we enable the firewall, type:
Code:
sudo ufw enable
Press Y if you see a message
Now, check the current firewall status by typing:
Code:
sudo ufw status
You should see something like this:
Apache Full ALLOW Anywhere
Apache Full (v6) ALLOW Anywhere (v6)
Test Apache service, type:
Code:
sudo service apache2 status
You should see something like this:
Alot more but notice this line,

Active: active (running) since Sat 2018-03-31 08:44:04 CEST; 15min ago
Now we can enter our webpage to see if it works, enter SERVER_IP or DOMAINNAME.COM
If you do not know your server ip type this:

Code:
sudo ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
At the webpage you should see this.
Install MySQL
Two commands in one line, type:

Code:
sudo apt update && sudo apt install mysql-server
Press Y and hit ENTER when prompted to install the MySQL package.
Now check if the service is running, type:
Code:
sudo service mysql status
Agin, Focus this line:
Active: active (running) since Mon 2018-04-02 02:40:59 CEST; 2min 47s ago
Press q to exit, now we know the service is installed and running.
Configure MySQL Security
Recommended, GENERATE STRONG PASSWORD: Generate Password (link removed due to advertisement).

To configure security for MySQL, type:
Code:
sudo mysql_secure_installation
If you created a root password in Step 1, you may be prompted to enter it here. Otherwise you will be asked to create one.
You will be asked if you want to set up the Validate Password Plugin. It’s not really necessary unless you want to enforce strict password policies for some reason.
Code:
Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No:
Press ENTER here if you dont want to setup the validate password plugin

Code:
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) :
Press Y and ENTER to remove anonymous users
Code:
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
Press Y and ENTER to disallow root login remotley. This will prevent bots and hackers from trying to guess the root password.
Code:
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) :
Press Y and ENTER to remove the test database
Code:
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) :
Press Y and ENTER to reload the privilege tables
Now we are done with the MySQL, lets login into the MySQL and run the version command
Code:
sudo mysqladmin -p -u root version
Press q to exit

Install PHP
Update by typing:

Code:
sudo apt update && sudo apt install php libapache2-mod-php php-mysql
Press Y and ENTER when prompted to install the PHP package
Test PHP
Type:

Code:
php -version
If PHP installed correctly, you should see something similar below:
Code:
PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.3-1ubuntu1, Copyright (c) 1999-2018, by Zend Technologies
Now let's test PHP for Apache
We'll create a file called info.php which you can enter thru IP.COM/info.php or DOMAINNAME.COM/info.php.
NOTE! This file needs to be deleted due to dangerous information.
Create it by typing:

Code:
sudo nano /var/www/html/info.php
Once nano editor has opened, paste in the following PHP code.
Code:
<?php
phpinfo();
Press CTRL + X, press Y and then press ENTER to save it and exit.
Now enter IP.COM/info.php or DOMAINNAME.COM/info.php
It should look like this:

NOTE!
Once you’ve confirmed PHP is working correctly, it’s important to delete info.php as it contains information that could be useful to hackers.
Delete it by typing:

Code:
sudo rm /var/www/html/info.php
Now we need to change Max upload file size, type: (This is a must for DATABASE SQL files)
Code:
sudo nano /etc/php/7.2/apache2/php.ini
Press CTRL + W, Search for
Code:
upload_max_filesize
Change it to
Code:
upload_max_filesize = 64M
Press CTRL + W, search for
Code:
post_max_size
Change it to
Code:
post_max_size = 64M
Press CTRL + X, press Y and then hit ENTER to save & exit
Restart Apache/PHP
Type
Code:
sudo systemctl restart apache2
Install phpMyAdmin & Hide /phpmyadmin
Start with updating package and install phpmyadmin, type

Code:
sudo apt update && sudo apt install phpmyadmin
Do the following
[*] apache2
[ ] lightpd
Select Apache2 and press <OK>
Select Yes and press ENTER to install and configure the database.
Create a password for phpMyAdmin
Test phpMyAdmin
Enter IP.COM/phpmyadmin or DOMAINNAME.COM/phpmyadmin
it should look like this
Create MySQL User[/SIZE]
If you weren’t able to log in as root above, you can now create a superuser account just for phpMyAdmin.
In terminal, log into MySQL as root. You may have created a root password when you installed MySQL for the first time or the password could be blank, in which case you can just press ENTER when prompted for a password.
Type
Code:
sudo mysql -p -u root
Now add a new MySQL user with the username of your choice. In this example we are calling it pmauser (php my admin user). Make sure to replace password_here with your own (generate a password (link removed due to advertisement)).
The % symbol tells MySQL to allow this user to log in from anywhere remotely. If you want heightened security, you could replace this with an IP address.
type
Code:
sudo mysql -p -u root
Now add a new MySQL user with the username of your choice. In this example we are calling it pmauser (php my admin user). Make sure to replace password_here with your own (generate a password (link removed due to advertisement)).
The % symbol tells MySQL to allow this user to log in from anywhere remotely. If you want heightened security, you could replace this with an IP address.
type
Code:
CREATE USER 'pmauser'@'%' IDENTIFIED BY 'password_here';
Now we will grant superuser privileges to our new user pmauser.
type

Code:
GRANT ALL PRIVILEGES ON *.* TO 'pmauser'@'%' WITH GRANT OPTION;
Now exit MySQL.
type

Code:
exit
 
Last edited:
Now we can go ahead and Obscure phpMyAdmin URL (Hide the /phpmyadmin for others to secure it.
Bots and attackers continuously scan web servers for the default phpMyAdmin login page, so it is recommended that you change the URL to something else.
In this example we are going to change it from example.com/phpmyadmin to example.com/pmahidden.
Open the phpMyAdmin configuration file for Apache using the nano text editor.
type
Code:
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
Change the Alias from /phpmyadmin to /pmahidden – you can change this to whatever you want.
Code:
# phpMyAdmin default Apache configuration

Alias /pmahidden /usr/share/phpmyadmin
Press CTRL + X, press Y and hit ENTER to save and exit
Now reload Apache service inorder to update changes
type
Code:
sudo service apache2 reload
You should now be able to access IP.COM/pmahidden or DOMAINNAME.COM/pmahidden (whatever you wrote)
Protect with .htpasswd
We can further protect the phpMyAdmin login page with .htpasswd. This adds another line of defence against bots and hackers.
Allow .htaccess Overrides (Optional) - Recommended
To set up .htpasswd, we must first change the phpMyadmin Apache configuration file to allow .htaccess Overrides.
Open the config file in nano text editor.
type
Code:
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
Add AllowOverride All underneath DirectoryIndex index.php
Code:
<Directory /usr/share/phpmyadmin>
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php
    AllowOverride All
Save and close by pressing CTRL + X, press Y and hit ENTER
Now reload Apache Service
type
Code:
sudo service apache2 reload
Set up .htpasswd
We are going to create a new .htaccess file in the phpMyAdmin install directory using the nano text editor.
Type

Code:
sudo nano /usr/share/phpmyadmin/.htaccess
Paste in the following
Code:
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user
Save & Exit, Press CTRL + X, press Y and hit ENTER
We can now generate the .htpasswd file using the htpasswd tool.
In this example, we are creating a new user called pmauser (php my admin user), though you can change this to whatever you want.
You will be asked to enter a new password twice (generate a password (link removed due to advertisement)).
That’s it, you’re done! Visit phpMyAdmin in your browser and you should now be prompted to enter login details.

Configuring Encrypt SSL Certy for Apache

Install Let's Encrypt client (Certbot)
Lets begin updating the package
type
Code:
sudo apt-get update && sudo apt-get install software-properties-common
Now add the repositories universe and certbot
Type

Code:
sudo add-apt-repository universe && sudo add-apt-repository ppa:certbot/certbot
Press ENTER if prompted
Update the package lists agin and install Certbot for Apache
type

Code:
sudo apt-get update && sudo apt-get install certbot python-certbot-apache
Press Y and ENTER when prompted to continue

Get an SSL Certificate
We will now obtain a cert for our test domain example.com. Certbot has an Apache plugin, which automates the certificate installation.
Type
Code:
sudo certbot --apache
Code:
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel):
Enter an email address where you can be contacted in case of urgent renewal and security notices.
Code:
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel:
Press a and ENTER to agree to the Terms Of Service
Code:
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o:
Press n and ENTER to not share your email adress with EFF
Code:
Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: example.com
2: www.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):
If you have multiple domains already configured on your server, you will see a list of them here. In this example, we only have one domain example.com and its www. prefix.
Select option 1 if you don’t want to use the www. prefix in your website address, otherwise select option 2.
Code:
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for example.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/example.com-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/example.com-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/example.com-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):
Press 2 and ENTER to redirect all traffic to HTTPS
Code:
Redirecting vhost in /etc/apache2/sites-enabled/example.com.conf to ssl vhost in /etc/apache2/sites-available/example.com-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
You are now done! Setup a website in the HTML folder
You can choose between

Gesior ACC TFS 1.0 - Gesior ACC GITHUB (link removed due to advertisement).
Znote ACC TFS 1.0 - Znote Acc GITHUB (link removed due to advertisement).

ServerFiles to choose from
The forgotten server TFS 1.2 (@Mark) - Marks TFS 1.2 Files (link removed due to advertisement).
OTServBR (12.20 Client) - Github (link removed due to advertisement).

Server Tutorials

The Forgotten Server 1.2 - Github Tutorial (link removed due to advertisement).
OTServBR on Linux - Not uploaded yet.

Enjoy!
 
Last edited:
nice tutorial, but 90% of the links are being blocked by my antivirus because of the (maranhesduve (dot) club) link
 
nice tutorial, but 90% of the links are being blocked by my antivirus because of the (maranhesduve (dot) club) link
Thanks, creating another tutorial soon.
It's becouse of Adf.ly, the content on there. Don't click anything beside "Skip ad" and you're fine.
I'll update links to a better format instead of adf.ly tomorrow
 
Last edited:
Remove the advertisement from your links and add the normal URLs. If you want to earn money this isn’t how you do it.
Thank you for understanding.
 
The links in this tutorial are not there and will not be there for now due to some staff removing permission to edit this therd.
Sorry for anyone that are looking for a tutorial like this, privat msg me to get the links (Normal links).
 
Dear Klonera,

Worked for me, thanks for sharing!

Just for noobs like me, the command to execute on the these step is : htpasswd -c /path/to/your/file/PasswordFileName username

Save & Exit, Press CTRL + X, press Y and hit ENTER
We can now generate the .htpasswd file using the htpasswd tool.
In this example, we are creating a new user called pmauser (php my admin user), though you can change this to whatever you want.
You will be asked to enter a new password twice (generate a password (link removed due to advertisement)).
That’s it, you’re done! Visit phpMyAdmin in your browser and you should now be prompted to enter login details.
 
getting this

-- Found Threads: TRUE
-- Found PugiXML: /usr/include
-- Could NOT find LuaJIT (missing: LUA_LIBRARIES LUA_INCLUDE_DIR)
-- Found Lua: /usr/lib/x86_64-linux-gnu/liblua5.2.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "5.2.4")
CMake Error at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1947 (message):
Unable to find the requested Boost libraries.

Boost version: 1.65.1

Boost include path: /usr/include

Detected version of Boost is too old. Requested version was 1.66 (or
newer).
Call Stack (most recent call first):
CMakeLists.txt:63 (find_package)


-- IPO / LTO enabled
-- Configuring incomplete, errors occurred!
See also "/root/forgottenserver/build/CMakeFiles/CMakeOutput.log".
See also "/root/forgottenserver/build/CMakeFiles/CMakeError.log".
 
error on sudo update upgrade first steps, using 16.04 ubuntu


Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporari ly unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is an other process using it?
root@euve274222:~#
 
I can create an updated version for this, give me some time to grab a machine for some tutorials
 
Hiya, thanks for uploading your guide. I was just wondering how I go about this step?
Now we can enter our webpage to see if it works, enter SERVER_IP or DOMAINNAME.COM
Any advice would be appreciated.
- Seroquel
 
advice would be appreciated.
That's your public ip adress, if you entered using putty/winscp onto your machine. That's your public ip-adress, you can find it anywhere located over at your server information tab if you're using a host company.

If you're on your own network (Using a machine over your own rauter)
whatsmyip.org, that's your public ip-adress.
 
That's your public ip adress, if you entered using putty/winscp onto your machine. That's your public ip-adress, you can find it anywhere located over at your server information tab if you're using a host company.

If you're on your own network (Using a machine over your own rauter)
whatsmyip.org, that's your public ip-adress.
Thank you for the quick response. I set up an ubuntu server on a virtual box. But when I try to use the IP this line provides (see below) to connect with WinSCP it just times out. Similarly when I try to use the IP for this address in my browser (http://****/phpmadm) as some google guides suggested I get a "This site can't be reached ***** took to long to respond error.
Code:
sudo ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
- Seroquel
Post automatically merged:

EDIT: I used to get the error: "AH00558: apache2: Could not reliably determine the server's fully qualified domain name...", but managed to resolve that by setting the "ServerName" to 127.0.0.1 in "/etc/apache2/apache2.conf".
 
Last edited:
Thank you for the quick response. I set up an ubuntu server on a virtual box. But when I try to use the IP this line provides (see below) to connect with WinSCP it just times out. Similarly when I try to use the IP for this address in my browser (http://****/phpmadm) as some google guides suggested I get a "This site can't be reached ***** took to long to respond error.
Code:
sudo ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
- Seroquel
Post automatically merged:

EDIT: I used to get the error: "AH00558: apache2: Could not reliably determine the server's fully qualified domain name...", but managed to resolve that by setting the "ServerName" to 127.0.0.1 in "/etc/apache2/apache2.conf".
Did you re-direct the phpmyadmin or even installed it yet?
If not, check the steps below.
 
Did you re-direct the phpmyadmin or even installed it yet?
If not, check the steps below.
I have not, I thought it be best to complete each step successfully before moving on as I am a complete noob to this. I've spent the whole day trying to figure it out and to be honest your guide was an absolute godsent. Thank you.
- Seroquel
Post automatically merged:

Once nano editor has opened, paste in the following PHP code.
Code:
<?php
phpinfo();
Press CTRL + X, press Y and then press ENTER to save it and exit.
Now enter IP.COM/info.php or DOMAINNAME.COM/info.php
It should look like this:

https://devanswers.co/wp-content/up...fo-test-apache-ubuntu-18-04-bionic-beaver.png
At this step I again get the connection timed out error. Is it something to do with the fact that I'm running it from a virtual box or maybe my firewall?
- Seroquel
 
Last edited:
I have not, I thought it be best to complete each step successfully before moving on as I am a complete noob to this. I've spent the whole day trying to figure it out and to be honest your guide was an absolute godsent. Thank you.
- Seroquel
Post automatically merged:


At this step I again get the connection timed out error. Is it something to do with the fact that I'm running it from a virtual box or maybe my firewall?
- Seroquel
This is due to your configuration of PHP, you are prob using an outdated/wrong php version.
- Check your php version by: php -version

I'd think it's inside here: sudo nano /etc/apache2/conf-available/phpmyadmin.conf

change your php version from 7.2 to 7.4 or whatever version you have.
Sadly, it's a while ago i used Apache. Should be inside there.
 
This is due to your configuration of PHP, you are prob using an outdated/wrong php version.
- Check your php version by: php -version

I'd think it's inside here: sudo nano /etc/apache2/conf-available/phpmyadmin.conf

change your php version from 7.2 to 7.4 or whatever version you have.
Sadly, it's a while ago i used Apache. Should be inside there.
1638620555045.png
I tried that earlier, I'm on 7.4.3

EDIT: I found the problem, I didn't have my network option set to bridged. Thank you very much for your help I really appreciated it. <3

- Seroquel
 
Last edited:
Followed the second part of your tutorial - thanks for the help on the SSL front, was a quick edit and worked instantly just as you described. [Ubuntu 16.04 - Oracle Cloud Hosting]
 
i tried go though that tutorial which is great, just i stuck on

Test phpMyAdmin
i mean when i am trying to give my ipaddress / phpmyadmin nothing show up

how to fix it?


OK fixed, here is solution:

Step 1. Open the file:

sudo nano /etc/apache2/apache2.conf

Step 2: Add the following line at the end of file:

Include /etc/phpmyadmin/apache.conf

Step 3: Restart apache2:

sudo systemctl restart apache2.service
 
Last edited:
Back
Top