Setting up mariadb on Debian system

Started by alex.thomson, Aug 08, 2022, 03:42 AM

Previous topic - Next topic

alex.thomsonTopic starter

I accidentally obtained a motherboard from a laptop and a few more components, which led me to try and save on a hosting provider by creating a makeshift "server" for my educational website.



 The power consumption is low and the cooling is passive, making this setup perfect for my needs. Here are the specs: Intel Atom processor E3800, 2 Gb SODIMM DDR3 memory, and a FoxLine 8Gb HalfSlim SATA SSD storage device. For network interfaces, I'm using a Realtec RTL810xE Fast Ethernet controller 100Mbit and a Realtec RTL8723BE PCIe Wireless Network Adapter.

To install Debian 11, I downloaded the iso and Rufus to create a bootable flash drive. Despite some devices requiring non-free firmware, which can be loaded from external media, the installation process was straightforward. I chose the wi-fi module and connected to my wireless network during installation. After rebooting, I had to locally log in as root and execute a few commands to enable the wlp4s0 interface at system startup. Overall, while this project is just for self-development, it's been interesting to see how the system works.

In order to set up my computer as a server, I needed to focus on the address lines: the IP address, subnet mask, gateway, and DNS nameservers, as well as the Wi-Fi network name and password.

After setting a static address, I saved the changes and rebooted the system using # systemctl reboot. After rebooting, SSH login became available. Next, I installed sudo with three simple commands and created a unique user for FTP. To configure the FTP, I used the previously installed sudo and created a directory with appropriate access and ownership rights.

Finally, I installed mariadb and executed the initial configuration script, answering a few questions along the way.
  •  

kosmon

In testing the AX201 on my computer and connecting to the provider's server in my city, I found a 5 ms ping. Although data transfer speed may be affected due to one channel being used for all devices connected to the router, this is not significant for the author's web server. While neighbors in high-rise buildings may interfere through occupied channels, in our case, there are only two routers at 5 GHz, with the rest sitting at 2.4 GHz on the provider's modems.

The main point is that Wi-Fi is now comparable to a wired connection, although it is not necessary to make an immediate switch to air. The majority of traffic consumption now comes from mobile devices, which cannot be easily connected through copper or optics. Copper works well when there are only up to four devices in the house; otherwise, a pile of switches and wires become inevitable.
  •  

ElioFroton

Although I have used Lamp many times, I have struggled with getting past the initial setup due to the complexity of launching necessary Apache modules in Linux via terminal. In comparison, Windows is much more user-friendly in this regard.

My recommendation would be to install a regular Nix system, rather than complicating things from the start. If hardware is limited, using a virtual machine for experimentation is sufficient to avoid potential compatibility issues. Additionally, experience with Nix systems will ultimately be necessary for any serious development work.
  •  

fefGrossy

To set up MariaDB on a Debian system, you can follow these steps:

1. Update the package lists by running the following command:
```
sudo apt update
```

2. Install the `mariadb-server` package by running the following command:
```
sudo apt install mariadb-server
```

3. After the installation is complete, MariaDB will automatically start running. You can verify it by checking the status using:
```
sudo systemctl status mariadb
```

4. To secure your MariaDB installation, run the security script provided by MariaDB by executing the following command:
```
sudo mysql_secure_installation
```
You will be prompted to set a root password, remove anonymous user accounts, disable remote root login, and remove the test database.

5. Once the script completes, you can access the MariaDB shell by running:
```
sudo mysql
```

6. From the MariaDB shell, you can create databases, users, and grant privileges as needed. For example, to create a new database, you can use the following command:
```
CREATE DATABASE your_database_name;
```

7. You can then create a user and grant them access to the database using the following command:
```
CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON your_database_name.* TO 'your_username'@'localhost';
FLUSH PRIVILEGES;
```

8. Once you have configured your databases and users, you can exit the MariaDB shell by typing:
```
exit
```

Here are some additional steps you can take when setting up MariaDB on a Debian system:

1. To start or stop the MariaDB service manually, you can use the following commands:
  - Start MariaDB: `sudo systemctl start mariadb`
  - Stop MariaDB: `sudo systemctl stop mariadb`
  - Restart MariaDB: `sudo systemctl restart mariadb`

2. If you want MariaDB to start automatically on system boot, you can enable it with the following command:
  ```
  sudo systemctl enable mariadb
  ```

3. To configure the MariaDB server, you can edit the `/etc/mysql/mariadb.conf.d/50-server.cnf` file using a text editor such as `nano` or `vi`. This file contains various configuration options that you can modify based on your requirements.

4. If you need to access MariaDB remotely from another machine, you may need to configure the firewall to allow incoming MySQL/MariaDB connections on port 3306. You can use the following command to open the port on the firewall:
  ```
  sudo ufw allow 3306
  ```

5. To enhance the security of your MariaDB installation, consider implementing measures such as limiting network access, using strong passwords, and regularly updating MariaDB and the operating system.

6. If you encounter any issues or need more advanced configuration options, refer to the official MariaDB documentation or consult online resources and forums for assistance.
  •