{"id":23881765,"url":"https://github.com/fkrzski/linux-server-configuration","last_synced_at":"2026-05-06T19:03:34.602Z","repository":{"id":41445746,"uuid":"509596068","full_name":"fkrzski/Linux-server-configuration","owner":"fkrzski","description":"Linux server pacakges configuration, good to know commands, packages and tutorials","archived":false,"fork":false,"pushed_at":"2023-04-07T20:19:02.000Z","size":55,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-04T01:58:46.815Z","etag":null,"topics":["apache2","configuration","linux","mysql","node-js","php","phpmyadmin"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fkrzski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-01T21:45:43.000Z","updated_at":"2023-08-14T19:51:42.000Z","dependencies_parsed_at":"2023-01-21T08:38:38.868Z","dependency_job_id":null,"html_url":"https://github.com/fkrzski/Linux-server-configuration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkrzski%2FLinux-server-configuration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkrzski%2FLinux-server-configuration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkrzski%2FLinux-server-configuration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkrzski%2FLinux-server-configuration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fkrzski","download_url":"https://codeload.github.com/fkrzski/Linux-server-configuration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240254292,"owners_count":19772392,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache2","configuration","linux","mysql","node-js","php","phpmyadmin"],"created_at":"2025-01-04T01:58:52.253Z","updated_at":"2026-05-06T19:03:29.565Z","avatar_url":"https://github.com/fkrzski.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# INFO\n- Guide created using Debian 11 \n- If you don't have `apt` package manager maybe you have [one of this package managers](https://www.geekboots.com/story/list-of-linux-package-manager-and-their-utility)\n- If you have any suggestions create an Issue :D \n\n\n# PHP\n## Installation\n\n#### 1. Update and upgrade `apt` package manager\n```shell\nsudo apt update \u0026\u0026 sudo apt upgrade -y\n```\n\n#### 2. Install required packages\n```shell\nsudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2\n```\n\n#### 3. Add Ondrej Surý repository to sources list to be able to download and install PHP 8.*\n```shell\nsudo add-apt-repository ppa:ondrej/php\n```\n\n#### 4. Update `apt` package manager\n```shell\nsudo apt update\n```\n\n#### 5. Install PHP\nYou can replace with any other version of PHP, for example `php5.6`\n```shell\nsudo apt install php8.1 -y \n```\n\n#### 6. Check installation\n```shell\nphp --version\n```\n\n#### 7. Optional most used packages\n```shell\nsudo apt install php8.1-{bcmath,xml,fpm,mysql,zip,intl,ldap,gd,cli,bz2,curl,mbstring,pgsql,opcache,soap,cgi} -y\n```\n\n## Optional configuration\nAll changes are in `php.ini` file. If you want set changes for CLI you need to update `.ini` file from `/etc/php/8.1/cli/` directory. But if you want changes for websites you need to change `.ini` file from `/etc/php/8.1/apache2/` directory\n```shell\nsudo nano /etc/php/8.1/cli/php.ini\n```\n\nAfter changing in `apache2` directory you must ***ALWAYS*** restart Apache2 server\n```shell\nsudo systemctl restart apache2\n```\n\nIn `nano` you can go to specific line using CTRL + SHIFT + - , typing line number and pressing ENTER\n\n#### Bigger POST upload size\n```shell\npost_max_size = 16M # Line 698\n```\n\n#### Bigger file upload size\n```shell\nupload_max_filesize = 16M # Line 850\n```\n\n#### More memory limit\n```shell\nmemory_limit = 256M # Line 430\n```\n\n\n# Composer\n#### 1. Update and upgrade `apt` package manager\n```shell\nsudo apt update \u0026\u0026 sudo apt upgrade -y\n```\n\n#### 2. Install required PHP packages\nReplace `php8.1` with yours PHP version\n```shell\nsudo apt install wget php8.1-cli php8.1-zip unzip -y\n```\n\n#### 3. Download Composer installer\n```shell\nwget -O composer-setup.php https://getcomposer.org/installer\n```\n\n#### 4. Install Composer globally (For all users)\nYou can change installation directory by changing `/usr/local/bin` in `--install-dir=` parameter\n```shell\nsudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer\n```\n\n#### 5. Update Composer\n```shell\nsudo composer self-update  \n```\n\n#### 6. Check Composer version\n```shell\nsudo composer --version  \n```\n\n\n# MySQL\nInstallation and basic configuration of MySQL and MySQL server\n\n## Installation\n#### 1. Update and upgrade `apt` package manager\n```shell\nsudo apt update \u0026\u0026 sudo apt upgrade -y\n```\n\n#### 2. Install required packages\n``` shell\nsudo apt install gnupg wget -y\n```\n#### 3. Download MySQL `.deb` package\nYou can download another version of MySQL form [here](https://dev.mysql.com/downloads/)\n```shell\n# Example link, you put your link after wget\nwget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb\n```\n\n#### 4. Add downloaded `.deb` package to package manager\nRun your dpkg package with the `-i` flag, that indicates that you’d like to install from the specified file and `*` char depends all files that's name start from `mysql-apt-config`\n```shell\nsudo dpkg -i mysql-apt-config*\n```\nWhen you see screen with MySQL and MySQL tools select menu, select mysql-8 and press ENTER, press TAB and ENTER. \n\n#### 5. Update `apt` package manager\n```shell\nsudo apt update\n```\n\n#### 6. Install MySQL server\n```shell\nsudo apt install mysql-server -y\n```\nDuring installation, you must set root account password and select authentication plugin. I recommend `Strong password encryption`\n\n#### 7. Check installation\n```shell\nsudo mysql --version\n```\n\n## Configuration\n#### 1. Run secure installation and configure MySQL\n```shell\nsudo mysql_secure_installation\n```\nDuring installation, you need to configure the password validation level, choose whether you want to change the root password (if set), delete anonymous users or not, prohibit remote root login, delete the test database and reload the permissions. \u003cbr\u003e\nI recommend: 2, No (if set), Yes, Yes, Yes, Yes\n\n\n# phpMyAdmin\n## Install phpMyAdmin\n#### 1. Update and upgrade `apt` package manager\n```shell\nsudo apt update \u0026\u0026 sudo apt upgrade -y\n```\n\n#### 2. Install `phpMyAdmin` and required packages\nChange `php8.1` to your version, for example `php5.6`\n```shell\nsudo apt install wget php8.1 php8.1-cgi php8.1-mysqli php8.1-mbstring libapache2-mod-php php8.1-common php8.1-mysql phpmyadmin -y\n```\nDuring installation, you need to select phpMyAdmin type (Apache or lighthttpd). Press SPACE to select, TAB and ENTER.\nNext you must set up password to phpMyAdmin user and confirm it with root password (Set up in MySQL section)\n\n## Configure phpMyAdmin and resolve `Deprecated...` warnings and errors\n#### 1. Go to folder with phpMyAdmin\n```shell\ncd /usr/share\n```\n\n#### 2. Create backup of phpMyAdmin\n```shell\nsudo mv phpmyadmin/ phpmyadminold/\n```\n\n#### 3. Choose phpMyAdmin version and download\nGo to [phpMyAdmin version list](https://www.phpmyadmin.net/files/), select wanted version and copy link.\n```shell\nwget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.zip\n```\n\n#### 4. Unzip downloaded folder\n```shell\nsudo unzip phpMyAdmin*\n```\n\n#### 5. Copy downloaded directory and rename\n```shell\nsudo cp -r phpMyAdmin-5.2.0-all-languages phpmyadmin\n\n# Optionally you can remove old directory\nsudo rm -rf phpmyadminold\n```\n\n#### 6. Create `/tmp` directory for phpMyAdmin\n```shell\nsudo mkdir /usr/share/phpmyadmin/tmp\n```\n\n#### 7. Change permission to created directory\n```shell\nsudo chmod -R 777 /usr/share/phpmyadmin/tmp\n```\n\n#### 8. Copy config file for `phpMyAdmin`\n```shell\nsudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php \n```\n\n#### 9. Set up `blowfisz_secret` encrypting property\n```shell\nsudo nano /usr/share/phpmyadmin/config.inc.php\n```\n\nGo to line 16 (Press CTRL + SHIFT + -, type `16` and press ENTER) and set up variable (Must be 32 characters long!)\n```shell\n$cfg['blowfish_secret'] = '11112222333344445555666677778888'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */\n```\n\n\n# Apache2 virtualhosts\nYou need to rename all `domain.com` with yours domain name\n\n#### 1. Create a domain directory\nThe `-p` flag create a `/websites` folder if you don't have it\n```shell\nsudo mkdir -p /websites/domain.com\n```\n \n#### 2. Create a configuration file for a domain\n```shell\nsudo nano /etc/apache2/sites-available/domain.com.conf\n```\n\n#### 3. Configure Virtual Host for your website\n```shell\n\u003cVirtualHost *:80\u003e\n    ServerAdmin admin@domain.com\n    ServerName domain.com\n    ServerAlias www.domain.com\n    \n    DocumentRoot /websites/domain.com\n    \n    ErrorLog ${APACHE_LOG_DIR}/error.log\n    CustomLog ${APACHE_LOG_DIR}/access.log combined\n    \n    \u003cDirectory /websites/domain.com\u003e\n        Options Indexes FollowSymLinks\n        AllowOverride All\n        Require all granted\n    \u003c/Directory\u003e\n     \n    # SSL certificate, from HTTP to HTTPS\n    RewriteEngine on\n    RewriteCond %{SERVER_NAME} =domain.com [OR]\n    RewriteCond %{SERVER_NAME} =www.domain.com\n    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]\n\u003c/VirtualHost\u003e\n```\n\n#### 4. Restart Apache2 server\n```shell\nsudo systemctl restart apache2\n```\n\n#### 5. Enable site using `a2ensite`\n```shell\nsudo a2ensite domain.com.conf\n```\n\n#### 6. Enable `rewrite` module in `a2ensite`\n```shell\nsudo a2enmod rewrite\n```\n\n#### 7. Restart Apache2\n```shell\nsudo systemctl reload apache2\n```\n\n#### 8. Setting up default Virtual Host to works correct\nIf you want host something on default host (`000-deafult.conf`) - for example: *RoundCube* - you need to set `\u003cDirectory\u003e` tag in this Virtual Host like this:\n```shell\nsudo nano /etc/apache2/sites-available/000-default.conf\n```\n\nAnd under `CustomLog ${APACHE_LOG_DIR}/access.log combined` line you must put this lines\n```shell\n\u003cDirectory /var/www/html\u003e\n    Options Indexes FollowSymLinks\n    AllowOverride All\n    Require all granted\n\u003c/Directory\u003e\n```\n\n\n# Certbot\n## Installing Certbot\n\n#### 1. Update and upgrade `apt` package manager\n```shell\nsudo apt update \u0026\u0026 sudo apt upgrade -y\n```\n\n#### 2. Install `snapd` package for another package managing\n```shell\nsudo apt install snapd -y\n```\n\n#### 3. Install `core` package using `snap`\n```shell\nsudo snap install core\n```\n\n#### 4. Refresh `core` using `snap`\n```shell\nsudo snap refresh core\n```\n\n#### 5. Install Let'sEncrypt `certbot` using `snap` package\n```shell\nsudo snap install --classic certbot\n```\n\n#### 6. Add symbolic link between snap installation folder and user sharable folder\n```shell\nsudo ln -s /snap/bin/certbot /usr/bin/certbot\n```\n\n## Working with certificates\n#### Adding certificate do domain\nYou need to replace all `domain.com` with your domain name and `email@email.com` with your email address \u003cbr\u003e\u003cbr\u003e\n***You need to add new certificate for all subdomains!***\n```shell\nsudo certbot --apache --agree-tos --redirect -m email@email.com -d domain.com -d www.domain.com\n```\n\nIf this is your first certificate on machine you need to agree wih TOS - type `Y` and press ENTER\n\n\n# Git\n#### 1. Update and upgrade `apt` package manager\n```shell\nsudo apt update \u0026\u0026 sudo apt upgrade -y\n```\n\n#### 2. Install Git\n```shell\nsudo apt install git -y\n```\n\n#### 3. Check installation\n```shell\nsudo git --version\n```\n\n\n# SSH keys\n#### 1. Generate SSH key\n```shell\nsudo ssh-keygen -t rsa\n```\n\n#### 2. Get SSH key:\n```shell\nsudo cat /root/.ssh/id_rsa.pub\n```\n\n\n# NodeJS and NPM\n#### 1. Add `.deb` package to package manager\nReplace `16.x` with wanted version of NodeJS\n```shell\ncurl -s https://deb.nodesource.com/setup_16.x | sudo bash\n```\n\n#### 2. Install NodeJS using `apt` package manager\n```shell\nsudo apt install nodejs -y\n```\n\n#### 3. Check installation\n```shell\nsudo node -v\n```\n\n\n# Angular CLI\n#### 1. Install Angular CLI globally using `-g` flag\n```shell\nsudo npm install -g @angular/cli\n```\n\n#### 2. Check installation\n```shell\nsudo ng version\n```\n\n\n# Python\n## Installation\n#### 1. Update and upgrade `apt` package manager\n```shell\nsudo apt update \u0026\u0026 sudo apt upgrade -y\n```\n\n#### 2. Install required packages\n```shell\nsudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev -y\n```\n\n#### 3. Download Python from official website\nYou can select another version from [here](https://www.python.org/ftp/python/)\n```shell\nwget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz\n```\n\n#### 4. Unzip downloaded package to install \n```shell\nsudo tar -xvf Python-3.10.0.tgz\n```\n\n#### 5. Enter Python folder\n```shell\ncd Python-3.10.0\n```\n\n#### 6. Run configure script for Python \n```shell\nsudo ./configure --enable-optimizations\n```\n\n#### 7. Make Python installation\n```shell\nsudo make -j 2\n```\n\n#### 8. Make alt-install for Python\n```shell\nsudo make altinstall\n```\n\n#### 9. Check installation\n```shell\nsudo python3.10 --version\n```\n\n## PIP3\n#### 1. Install required packages\n```shell\nsudo apt install python3-venv python3-pip -y\n```\n\n#### 2. Install PIP and automatically upgrade\n```shell\nsudo pip3 install --upgrade pip\n```\n\n## Change default version of Python\n#### 1. Update alternatives for Python\nYou need to change `/usr/local/bin/python3.10` to path to Python version that you want to set as default. \u003cbr\u003e\n`1` number is a priority. `1` is the highest.\n```shell\nsudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.10 1\n```\n\n\n# Other packages\n## Sudo\n#### 1. Update and upgrade `apt` package manager\n```shell\napt update \u0026\u0026 apt upgrade -y\n```\n\n#### 2. Install `sudo` package\n```shell\napt install sudo -y\n```\n\n## Firefox\n#### 1. Update and upgrade `apt` package manager\n```shell\napt update \u0026\u0026 apt upgrade -y\n```\n\n#### 2. Install browser using `apt` package manager\n```shell\nsudo apt install firefox-esr -y\n```\n\n\n## Geckodriver\n#### 1. Update and upgrade `apt` package manager\n```shell\napt update \u0026\u0026 apt upgrade -y\n```\n\n#### 2. Download `tar` archive with Geckodriver\n```shell\nwget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz\n```\n\n#### 3. Extract archive \n```shell\nsudo tar -xvzf geckodriver-v0.32.0-linux64.tar.gz\n```\n\n#### 4. Make file executable\n```shell\nsudo chmod +x geckodriver\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffkrzski%2Flinux-server-configuration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffkrzski%2Flinux-server-configuration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffkrzski%2Flinux-server-configuration/lists"}