Jump to content

Recommended Posts

Posted (edited)

Description

This topic is part of a multi-part series. We'll try to get everything straight to the point in this guide, without unnecessary over-explanation.

PART 1 [THIS GUIDE]

  • Work faster with a better terminal emulator.
  • Use a better editor.
  • Basic L2J server setup.
  • Manage and secure your MySQL server. [!]

 

PART 2 [CLICK HERE]

  • Secure your Linux server.
  • Tuning system profiles. [!]
  • Network performance tuning. [!]
  • How to build and manage a firewall using iptables and conntrack - simplified version. [!]

 

PART 3 [CLICK HERE]

  • Understanding and managing the OVH Firewall. [!]
  • How to build and manage a firewall using iptables, conntrack, ipset and synproxy - advanced version. [!]
  • Mitigating most of the DDoS attacks. [!]


Linux Distro

gnu-linux-distribution-timeline.png

 

In this guide, we will choose the Red Hat distribution, CentOS 8 more precisely. There shouldn't be too much difference between the versions for our purpose.
 

Terminal Emulator

me.png


F@$% Putty. It is not making your life easier!
We should instead use a client with more features, such as password saving and macros.
I strongly recommend you MobaXterm, you can record, edit and run macros (among other awesome features). The free version has some minor limitations, but the pro version doesn't and the license is lifetime - this is the one I got. I own a portable version with a master password for security.
 

Pre-Installation

 

In all our commands we will use -y with our CLI commands, so we skip the yes/no confirmation. We'll use the package managers yum and dnf. Most of our commands will include sudo (running on the highest privilege). We could use sudo su to login as super-user instead.

It is very important to get all the updates first:

 

sudo yum update -y

 

Installation

 

Starting with the following packages:

apel-release is an Extra Packages for Enterprise Linux;
screen is only useful if you run AAC in screen mode;
nano is my favorite editor;
tcpdump is a data network packet analyzer - we will use it to capture network packets for analysis - very useful if you are under attack and want to know what and how.

 

sudo yum install epel-release -y
sudo yum install screen -y
sudo yum install nano -y
sudo yum install tcpdump -y

 

Use A Better Editor

 

Nano is easier and quicker!

You can open a file like any other editor:

 

nano <directory and filename>


Saving is quite simple which is why I like it:

CTRL+X -> Y -> ENTER to save
CTRL+X -> N -> ENTER not to save
 

Java

We'll use wget to get the java from the web:

 

sudo dnf install wget -y
wget https://download.oracle.com/java/19/latest/jdk-19_linux-x64_bin.rpm
sudo rpm -i jdk-19_linux-x64_bin.rpm

 

MariaDb

Installation:

 

sudo yum install mariadb-server -y
sudo systemctl start mariadb
sudo systemctl enable mariadb


Start the configuration:

 

sudo mysql_secure_installation

 

Configuring the MariaDb

Important Rules

 

  1. Do NOT use root for remote access. [!]
  2. Create a db user for every purpose. [!]
  3. Never allow a user from all IPs. [!]
  4. In addition to the MySQL IP permission, do the same on the firewall side. [!]


MariaDB's config file on CentOS 8 so you can allow remote access:

 

nano /etc/my.cnf.d/mariadb-server.cnf


Enter MySQL as root:

 

mysql -u root -p


 Database creation:

 

CREATE DATABASE login;
CREATE DATABASE game;


User creation:

1. We can start by creating the local user for the login and game servers; only accessed by the machine itself on localhost.
Db username: localuser
Db password: localpassword

 

CREATE USER 'localuser'@'localhost' IDENTIFIED BY 'localpassword';
GRANT ALL ON *.* to 'localuser'@'localhost' IDENTIFIED BY 'localpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;


2. We create a remote user, so you can access it from your own computer.
Db username: trance
Db password: changemelater123
Trance's VPN or HOME IP (if static): 51.10.10.10

 

CREATE USER 'trance'@'localhost' IDENTIFIED BY 'changemelater123';
GRANT ALL ON *.* to 'trance'@'51.10.10.10' IDENTIFIED BY 'changemelater123' WITH GRANT OPTION;
FLUSH PRIVILEGES;


3. We create a web user, for your Account Panel.
Db username: ucp
Db password: changemelater456
Webhost's IP: 51.11.11.11

 

CREATE USER 'ucp'@'localhost' IDENTIFIED BY 'changemelater456';
GRANT ALL ON login.* to 'ucp'@'51.11.11.11' IDENTIFIED BY 'changemelater456' WITH GRANT OPTION;
FLUSH PRIVILEGES;

 

Tips and tricks:

 

*.* goes like <database name>.<tables access>
IP allowance: We can allow a whole network like: 'trance'@'51.10.%.%'


Db user limit example:
 

 Enter MySQL as root:

 

mysql -u root -p

 

And then:

 

GRANT ALL ON login.* TO 'ucp'@'51.11.11.11'
WITH MAX_QUERIES_PER_HOUR 500
MAX_UPDATES_PER_HOUR 50
MAX_CONNECTIONS_PER_HOUR 50
MAX_USER_CONNECTIONS 5;
FLUSH PRIVILEGES;


See db users and delete any if needed:
 

Enter MySQL as root:

 

mysql -u root -p


See all db users:

 

SELECT User,Host FROM mysql.user;


Delete a user example:

 

DROP USER 'ucp'@'51.11.11.11';
FLUSH PRIVILEGES;


Login and Game Servers

Login and Game Servers privilege to run the .sh files:

Hypothetically we have the Login and Game servers directory as follows:

  • server/login
  • server/game

 

We only need to do this once if the files are not going to be replaced:

 

cd server/login/
chmod +x LoginServer.sh LoginServerTask.sh
cd ~
cd server/game/
chmod +x GameServer.sh GameServerTask.sh


Run the Login and Game servers and then see the Game server console:

 

cd server/login/
./LoginServer.sh
cd ~
cd server/game/
./GameServer.sh
-f log/stdout.log


Reboot the OS

 

reboot

 

Credits

Give me credits if you share it anywhere else, including my Discord and MxC topic's URL.
Discord: Trance#0694

 

Edited by Trance
  • Like 1
  • Thanks 5
  • Upvote 2
  • Trance changed the title to The Linux Series! [PART 1]
Posted

its almost same for debian/ubuntu distribution that i use for servers, this is common knowledge for old people.

 

you must have lots of free time to make all this guides gj, this is actually a basic setup l2j server into linux distribution

Posted

@TranceThanks for guide this about linux setup.

I've a question.. Why should/choose to use linux instead of windows?

Linux has a reputation for being fast ok, but what's the real benefits for my server?

 

Posted (edited)
On 1/26/2023 at 3:46 PM, 'Baggos' said:

@TranceThanks for guide this about linux setup.

I've a question.. Why should/choose to use linux instead of windows?

Linux has a reputation for being fast ok, but what's the real benefits for my server?

 


We'll cover more in the next parts of this series.

Stability/Uptime - Linux is more reliable. Windows becomes slow over time, it needs to be rebooted more often than Linux.

Drivers - Windows drivers are mediocre. Your NIC (Network Interface) will even be taken down if some weird thing happens that it doesn't like.
 

Resources - how resources can be used and modified through the kernel is at a high level.

Security - it can be much safer.

Networking/Firewall - you can block unwanted traffic, allow desired traffic, redirect packets to alternate TCP/UDP ports, redirect packets to alternate IP addresses, protect against Denial of Service attacks. You can't do most of this on Windows.

Edited by Trance
  • Thanks 1
Posted

Thank you Mr.Gold!
Finally someone decided to share something a little more "elaborate". Probably some people won't like that you share the secrets behind the "fine-tune" as your list promises. "Waiting for the next chapters 🤓".

Posted
6 hours ago, &#x27;Baggos&#x27; said:

@TranceThanks for guide this about linux setup.

I've a question.. Why should/choose to use linux instead of windows?

Linux has a reputation for being fast ok, but what's the real benefits for my server?

 

to topup in trances reply i know some servers in linux with uptime 2 and 3 years no reboot

  • Trance featured this topic
  • 10 months later...
Posted
On 1/27/2023 at 1:40 AM, Trance said:

Description

This topic is part of a multi-part series. We'll try to get everything straight to the point in this guide, without unnecessary over-explanation.

PART 1 [THIS GUIDE]

  • Work faster with a better terminal emulator.
  • Use a better editor.
  • Basic L2J server setup.
  • Manage and secure your MySQL server. [!]

 

PART 2 [CLICK HERE]

  • Secure your Linux server.
  • Tuning system profiles. [!]
  • Network performance tuning. [!]
  • How to build and manage a firewall using iptables and conntrack - simplified version. [!]

 

PART 3 [CLICK HERE]

  • Understanding and managing the OVH Firewall. [!]
  • How to build and manage a firewall using iptables, conntrack, ipset and synproxy - advanced version. [!]
  • Mitigating most of the DDoS attacks. [!]


Linux Distro

gnu-linux-distribution-timeline.png

 

In this guide, we will choose the Red Hat distribution, CentOS 8 more precisely. There shouldn't be too much difference between the versions for our purpose.
 

Terminal Emulator

me.png


F@$% Putty. It is not making your life easier!
We should instead use a client with more features, such as password saving and macros.
I strongly recommend you MobaXterm, you can record, edit and run macros (among other awesome features). The free version has some minor limitations, but the pro version doesn't and the license is lifetime - this is the one I got. I own a portable version with a master password for security.
 

Pre-Installation

 

In all our commands we will use -y with our CLI commands, so we skip the yes/no confirmation. We'll use the package managers yum and dnf. Most of our commands will include sudo (running on the highest privilege). We could use sudo su to login as super-user instead.

It is very important to get all the updates first:

 

sudo yum update -y

 

Installation

 

Starting with the following packages:

apel-release is an Extra Packages for Enterprise Linux;
screen is only useful if you run AAC in screen mode;
nano is my favorite editor;
tcpdump is a data network packet analyzer - we will use it to capture network packets for analysis - very useful if you are under attack and want to know what and how.

 

sudo yum install epel-release -y
sudo yum install screen -y
sudo yum install nano -y
sudo yum install tcpdump -y

 

Use A Better Editor

 

Nano is easier and quicker!

You can open a file like any other editor:

 

nano <directory and filename>


Saving is quite simple which is why I like it:

CTRL+X -> Y -> ENTER to save
CTRL+X -> N -> ENTER not to save
 

Java

We'll use wget to get the java from the web:

 

sudo dnf install wget -y
wget https://download.oracle.com/java/19/latest/jdk-19_linux-x64_bin.rpm
sudo rpm -i jdk-19_linux-x64_bin.rpm

 

MariaDb

Installation:

 

sudo yum install mariadb-server -y
sudo systemctl start mariadb
sudo systemctl enable mariadb


Start the configuration:

 

sudo mysql_secure_installation

 

Configuring the MariaDb

Important Rules

 

  1. Do NOT use root for remote access. [!]
  2. Create a db user for every purpose. [!]
  3. Never allow a user from all IPs. [!]
  4. In addition to the MySQL IP permission, do the same on the firewall side. [!]


MariaDB's config file on CentOS 8 so you can allow remote access:

 

nano /etc/my.cnf.d/mariadb-server.cnf


Enter MySQL as root:

 

mysql -u root -p


 Database creation:

 

CREATE DATABASE login;
CREATE DATABASE game;


User creation:

1. We can start by creating the local user for the login and game servers; only accessed by the machine itself on localhost.
Db username: localuser
Db password: localpassword

 

CREATE USER 'localuser'@'localhost' IDENTIFIED BY 'localpassword';
GRANT ALL ON *.* to 'localuser'@'localhost' IDENTIFIED BY 'localpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;


2. We create a remote user, so you can access it from your own computer.
Db username: trance
Db password: changemelater123
Trance's VPN or HOME IP (if static): 51.10.10.10

 

CREATE USER 'trance'@'localhost' IDENTIFIED BY 'changemelater123';
GRANT ALL ON *.* to 'trance'@'51.10.10.10' IDENTIFIED BY 'changemelater123' WITH GRANT OPTION;
FLUSH PRIVILEGES;


3. We create a web user, for your Account Panel.
Db username: ucp
Db password: changemelater456
Webhost's IP: 51.11.11.11

 

CREATE USER 'ucp'@'localhost' IDENTIFIED BY 'changemelater456';
GRANT ALL ON login.* to 'ucp'@'51.11.11.11' IDENTIFIED BY 'changemelater456' WITH GRANT OPTION;
FLUSH PRIVILEGES;

 

Tips and tricks:

 

*.* goes like <database name>.<tables access>
IP allowance: We can allow a whole network like: 'trance'@'51.10.%.%'


Db user limit example:
 

 Enter MySQL as root:

 

mysql -u root -p

 

And then:

 

GRANT ALL ON login.* TO 'ucp'@'51.11.11.11'
WITH MAX_QUERIES_PER_HOUR 500
MAX_UPDATES_PER_HOUR 50
MAX_CONNECTIONS_PER_HOUR 50
MAX_USER_CONNECTIONS 5;
FLUSH PRIVILEGES;


See db users and delete any if needed:
 

Enter MySQL as root:

 

mysql -u root -p


See all db users:

 

SELECT User,Host FROM mysql.user;


Delete a user example:

 

DROP USER 'ucp'@'51.11.11.11';
FLUSH PRIVILEGES;


Login and Game Servers

Login and Game Servers privilege to run the .sh files:

Hypothetically we have the Login and Game servers directory as follows:

  • server/login
  • server/game

 

We only need to do this once if the files are not going to be replaced:

 

cd server/login/
chmod +x LoginServer.sh LoginServerTask.sh
cd ~
cd server/game/
chmod +x GameServer.sh GameServerTask.sh


Run the Login and Game servers and then see the Game server console:

 

cd server/login/
./LoginServer.sh
cd ~
cd server/game/
./GameServer.sh
-f log/stdout.log


Reboot the OS

 

reboot

 

Credits

Give me credits if you share it anywhere else, including my Discord and MxC topic's URL.
Discord: Trance#0694

 

Amazing! Thank you very much!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • https://www.4shared.com/s/fyGGySJVvfa  
    • PAYPAL& BINANCE PAYPAL& BINANCE
    • SOCNET STORE — is a unique place where you can find everything you need for your work on the Internet!   We offer the following range of products and services: Verified accounts with blue tick marks and confirmed documents in Instagram, Facebook, Twitter (X), LinkedIn; Gift cards and premium subscriptions for your services (Instagram Meta, Facebook Meta, Discord Nitro, Telegram Premium, YouTube Premium, Spotify Premium, ChatGPT, Netflix Premium, LinkedIn Premium, Twitter Premium, etc.); Telegram bot for purchasing Telegram Stars with a minimum markup with automatic delivery; Replenishment of your advertising accounts (in TikTok ADS, Facebook ADS, Google ADS, Bing ADS) + linking a bank card; Payment for any other service or subscription with a markup from 5 to 25% (depending on the cost of the subscription) Available payment methods: via PayPal, any cryptocurrency (+Binance Pay), Telegram Stars, Cash App, or any bank card.    Our online store  SOCNET.STORE  Our Telegram Stars Bot  SOCNET.CC  Our SMM-Panel for social media promotion  SOCNET.PRO  Telegram store  SOCNET.SHOP    News:  ➡ Telegram channel ➡ WhatsApp channel ➡ Discord server  Contacts and support:  ➡ Telegram support ➡ WhatsApp support ➡ Discord support: socnet_support ➡ Email support: solomonbog@socnet.store We have been operating for a long time and have gathered a huge list of reviews about our work! Our large list of positive and honest reviews is presented on our website!   VERIFIED ACCOUNTS    Verified old Instagram Meta account (2010-2020) with an active blue checkmark | Subscription has already been paid for 1 month in advance, account confirmed by documents: from $70 Verified old Facebook Meta account (2010-2023) with an active blue checkmark | Subscription has already been paid for 1 month in advance, account confirmed by documents: from $70 Verified Linkedin account (2010-2024) with an active checkmark and confirmed documents | Checkmark does not require renewal: from $80 Verified old Twitter (X) account (2010-2022) with an active blue checkmark | GEO: Tier 1-3 (your choice) | Subscription has already been paid for 1 month in advance: from $16    TELEGRAM STARS    Telegram Stars | 1 star from $0.0175 | Discounts for bulk orders | Delivery within 1-2 minutes automatically    GIFT SERVICES & PREMIUM SUBSCRIPTIONS  DISCORD NITRO Discord Nitro Classic (Basic) GIFT | 1/12 MONTHS | NO LOGIN OR PASSWORD NEEDED | Full subscription guarantee | Price from: $3.15 Discord Nitro FULL | 1/12 MONTHS | NO LOGIN OR PASSWORD NEEDED | Full subscription guarantee | Price from: $6.8 SPOTIFY PREMIUM Individual Spotify Premium plan for 1 month ON YOUR ACCOUNT | Available worldwide | Price from: $2.49 Family Spotify Premium plan for 1 month ON YOUR ACCOUNT | Works in any country | Price from: $3.75 Personal YouTube Premium Music on your account | 1 month | Ad-free YouTube | Price from: $3.75 Family YouTube Premium Music on your account | 1 month | Ad-free YouTube | Price from: $4.35 TELEGRAM PREMIUM Telegram Premium subscription for 1 month on your account | Authorization required (via TDATA or phone number) | Price from: $6 Telegram Premium subscription for 3 months on your account | No account authorization required | Guaranteed for full period | Price from: $17 Telegram Premium subscription for 6 months on your account | No account authorization required | Guaranteed for full period | Price from: $22 Telegram Premium subscription for 12 months on your account | No account authorization required | Guaranteed for full period | Price from: $37 GOOGLE VOICE • Google Voice Accounts (GMAIL US NEW) | Age/Year: Random 2024 | Phone Verified: Yes | Price from: $13 TWITTER(X) PREMIUM • Twitter Premium X subscription on your Twitter account for 1 month/1 year (your choice). Authorization in your Twitter account is required. Price from: $13 per month • Twitter X Premium Plus subscription with GROK AI on your Twitter account for 1 month/1 year (your choice). Authorization in your Twitter account is required. Price from: $55 NETFLIX PREMIUM • Netflix Premium subscription for 1 month on your personal account for any country, renewable after expiration | Price from: $10 CANVA PRO • CANVA PRO subscription for 1 month via invitation to your email | Price from: $1 CHATGPT 5 • Shared ChatGPT 5 Plus account FOR 2/5 USERS | Price from: $5 / $10 • Group ChatGPT 5 Plus subscription on your own email address for 1 month | Price from: $5 • Personal ChatGPT 5 Plus account FOR 1 USER or CHAT GPT PLUS subscription on your own account | Price from: $18 • ChatGPT 5 PRO account with UNLIMITED REQUESTS | Dedicated personal account FOR 1 USER ONLY or ON YOUR ACCOUNT | Works in any country or region | Price from: $220 Payment for any other subscription and replenishment of advertising accounts: Additional 5–20% to the cost of the subscription on the site or to the replenishment amount depending on the total purchase amount.   Attention: This text block does not represent our full product range; for more details, please visit the relevant links below! If you have any questions, our support team is always ready to help!       Our online store  SOCNET.STORE  Our Telegram Stars Bot  SOCNET.CC  Our SMM-Panel for social media promotion  SOCNET.PRO  Telegram store  SOCNET.SHOP    News:  ➡ Telegram channel ➡ WhatsApp channel ➡ Discord server  Contacts and support:  ➡ Telegram support ➡ WhatsApp support ➡ Discord support: socnet_support ➡ Email support: solomonbog@socnet.store We have been operating for a long time and have gathered a huge list of reviews about our work! Our large list of positive and honest reviews is presented on our website!  10% – 20% Discount or $1 BONUS for your registration  If you’d like to receive a $1 BONUS for your registration OR a DISCOUNT of 10% – 20% on your first purchase, simply leave a comment: "SEND ME MY BONUS, MY USERNAME IS..." You can also use the ready promo code across all our stores: "SOCNET" (15% discount!)  We invite you to COOPERATE and EARN with us  Want to sell your product or service in our stores and earn money? Want to become our partner or propose a mutually beneficial collaboration? You can contact us through the CONTACTS listed in this thread. Frequently Asked Questions and Refund Policy If you have any questions or issues, our fast customer support is always ready to respond to your requests! Refunds for services that do not fully meet the stated requirements or quality will only be issued if a guarantee and duration are explicitly mentioned in the product description. In all other cases, refunds will not be fully processed! By purchasing such services, you automatically agree to our refund policy for non-provided services. We currently accept CRYPTOMUS, Payeer, NotPayments, Perfect Money, Russian and Ukrainian bank cards, AliPay, BinancePay, CryptoBot, credit cards, and PayPal. The $1 registration bonus can only be used for purchases and only once after your first registration in any SOCNET project. We value every customer and provide replacements in case of invalid accounts through our contact methods! p.s.: Purchase bonuses can be used across any SOCNET projects: web store or Telegram bots.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock