Arch Linux - How to Install NamelessMC

Arch Linux - How to Install NamelessMC

Quick guide on how to install NamelessMC a website software for Minecraft.

1) PHP Configuration

1.1) Upgrade your php main package if not the latest supported.

pacman -Rsc php74
Uninstall PHP 7.4 and all modules

I will use php-legacy since 8.1 is the recommended by NamelessMC documentation

pacman -Syu php-legacy
php-legacy --version
PHP 8.1.22 (cli) (built: Aug 13 2023 06:26:25) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.22, Copyright (c) Zend Technologies

1.2) NamelessMC requires a few php extensions installed.

php-curl, php-mbstring, php-pdo, php-mysqlnd and php-xml are already part of the main package and there is no need to install them.

php-fpm - is needed to run nginx. Arch Documentation

pacman -Syu php-legacy-fpm
Installing php-fpm
systemctl enable php-legacy-fpm.service
systemctl start php-legacy-fpm.service
Enabling and starting php-fpm
pacman -Syu php-legacy-gd

1.3) Create the file /etc/php-legacy/conf.d/extensions and comment out all extensions in /etc/php-legacy/php.ini.

Add the extensions below to /etc/php-legacy/conf.d/extensions.

extension=curl
extension=zip
extension=gd
extension=pdo_mysql
extension=exif

Use the command below to confirm that the required extensions are running.

┬─[root@minecraft:/v/w/i/public]─[20:13:23]
╰─>$ php-legacy --modules
[PHP Modules]
Core
ctype
curl
date
dom
exif
fileinfo
filter
gd
hash
json
libxml
mbstring
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]
Use systemctl restart php-legacy-fpm.service after changes to the modules.

2) NGINX Configuration

I have used the DigitalOcean NGINX configuration generation tool to create my config.

The configuration files was added to version control.

2.1) Generate SSL certificates and copy them to the folder var/www/infoicraft.com.br/letsencrypt

┬─[root@minecraft:/v/w/i/letsencrypt]─[18:26:05]
╰─>$ ll
total 20K
-rwx------ 1 http http 3.7K Aug 19 18:22 chain.pem*
-rwx------ 1 http http 5.8K Aug 19 18:22 fullchain.pem*
-rwx------ 1 http http 3.2K Aug 19 18:22 privkey.pem*

2.2) Generate Stronger DH parameters for nginx SSL.

openssl dhparam -out /etc/nginx/ssl/dhparam.pem 4096
This command will take about an hour to complete.

2.3) For friendly URLS to work the line below had to be changed.

...
# index.php fallback
    location / {
        # Nameless Custom
        try_files $uri $uri/ /index.php?route=$uri$args;
        #try_files $uri $uri/ /index.php?$query_string;
    }
...    
/etc/nginx/sites-enabled/infoicraft.com.br.conf

3) NamelessMC Configuration

3.1) Download NamelessMC.

wget -O - "https://github.com/NamelessMC/Nameless/releases/latest/download/nameless-deps-dist.tar.xz" | tar --xz --extract --directory=/var/www/infoicraft.com.br/public/ --file -

3.2) Set the files permission.

┬─[root@minecraft:/v/w/i/public]─[21:22:46]
╰─>$ pwd
/var/www/infoicraft.com.br/public

find -type f -print0 | xargs -0 chmod 0600
find -type d -print0 | xargs -0 chmod 755

3.3) Create a new database for NamelessMC.

mysql -u root -p
# Remember to change 'yourPassword' below to be a unique > password
CREATE USER 'nameless'@'127.0.0.1' IDENTIFIED BY 'yourPassword';
CREATE DATABASE nameless;
GRANT ALL PRIVILEGES ON nameless.* TO 'nameless'@'127.0.0.1' WITH GRANT OPTION;
exit