Rafsun Sheikh
Posted on February 20, 2023
Many of us are a complete beginner when using Linux Operating System. Today we are going to learn how to install Linux Services into your Fedora Machine.
To use or configure any services we are going to follow these steps generally:
- Install the packages including the dependencies.
- Enable/restart the service
- Configure the service as per our requirements.
And these are the following services that we are going to learn to install today:
- FTP Server with vsftpd
- Web Server with wordpress
- Cloud Server with ownCloud
- Mail Server with roundcube
But, for Web Server and Cloud Server we need LAMP with phpmyadmin. So, before we start with the web server we will install and configure LAMP at first.
FTP Server
FTP stands for File Transfer Protocol. This protocol is used to transmit files between devices across a network. For instance, sending data from a computer to a server across the internet In a word, FTP is the language that devices use to transfer data over a TCP/IP network.
When files are uploaded to an FTP server, other users can access them from anywhere in the world by connecting to the server and downloading the files using the FTP protocol. Nevertheless, this illustration shows that you need a dedicated FTP server set up in order to exchange the data. No, setting up your computer to act as an FTP server is a simple process. While Windows users can use the Internet Information Services Manager, Linux users can easily install the FTP program on their computer.
You can easily install FTP on Fedora using the YUM package manager. Launch the Terminal and execute the command below.
sudo yum install vsftpd
You can verify the installation by checking the VSFTPD version installed on your system when done.
vsftpd -v
Configure FTP (vsftpd) on Fedora
You can check whether the ftp server is running or not by:
sudo service vsftpd status
To make the modifications effective, restart the VSFTPD server. Run the commands listed below.
sudo systemctl enable vsftpd
sudo systemctl restart vsftpd
Connect to the FTP server
Enter the following URL into your browser's address bar to access the FTP server:
ftp://[ip-address]
e.g.,
ftp://10.20.31.171
If you don’t know your local ip address use ifconfig. And you can find how to troubleshoot if ifconfig is not working.
ipconfig
LAMP with phpmyadmin
Steps to Setup LAMP
LAMP stands for:
- Linux
- Apache
- MySQL
- PHP
So we need to install all the services in our machine. Whereas Linux is already installed so we need to start from installing Apache.
Install Apache
sudo yum update upgrade
sudo yum install httpd
sudo yum install httpd-tools
To check the apache service:
sudo systemctl status httpd
Enable the service:
sudo systemctl start httpd
sudo systemctl enable httpd
Add the service permission to the firewall so that firewall lets other users use the service from the network:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
All necessary packages will be installed once the script has finished running, and we can test it by entering the IP address of our web server (localhost).
The basic site (the one we saw in the previous step) is activated by default on Apache. Its content is editable under /var/www/html.
Install MariaDB
sudo yum install mariadb-server mariadb -y
Enable mariadb:
sudo systemctl status mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb
To configure mariadb run the following commands:
sudo mysql_secure_installation
You will be encountered with the following Configuration options:
Enter current password for root (enter for none):
Press Enter
Switch to unix_socket authentication [Y/n]
Press n
Change the root password? [Y/n]
Press y
New password:
Re-enter new password:
You can give your own password like 12345678
Reminder : You will need this password to login into your phpmyadmin login page
Remove anonymous users? [Y/n]
Press y
Disallow root login remotely? [Y/n]
Press y
Remove test database and access to it? [Y/n]
Press n
Remove test database and access to it? [Y/n]
Press n
You will be completed with the configuration of mariadb by then:
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Install PHP
sudo yum install php -y
To check whether php is working fine or not we need to create a small .php file and move it to /var/www/html and try to access it from web browser.
To do that at first delete everything from our desired directory.
cd /var/www/html
sudo rm *
Then we create and edit the file using nano.
sudo nano index.php
And write the following lines into index.php file:
<?php
phpinfo();
?>
Save the file by ctrl+s and exit the file by ctrl+x.
We need to restart the apache server again.
sudo systemctl restart httpd
Now go to your web browser and search:
http://localhost/index.php
You should be able to see the basic php info page.
Install phpmyadmin
sudo yum install phpmyadmin -y
sudo systemctl restart httpd
Go to http://localhost/phpmyadmin
N.B: In the login page your username is root and password is the password that you gave during mysql_secure_installation.
Web Server
At first download wordpress
sudo wget https://wordpress.org/latest.zip
After download if you list the directory by ls you will find latest.zip is there. Let’s unzip it.
unzip latest.zip
Then ls again, you’ll find wordpress directory. Get inside the directory.
cd wordpress
And you’ll find all the files are there.
Copy all the files and directories into /var/www/html.
sudo cp * /var/www/html -r
Now Create a database for your wordpress installation:
sudo mysql -u root -p
####Enter Password : <Provide the password you've set during the mysql_secure_installation>
create database wordpress; # wordpress is the database name here
show databases: # to find the already created databases
create user "admin"@"%" identified by "password"; # this is a important step as we need to provide a username and a password while installing wordpress
#Here admin is the useraname and password is the password and "@"%" along with username is a requirement to give while creating username
grant all privileges on wordpress.* to "admin"@"%";
#this line is for granting access to the database wordpress by user admin
exit
Now you are done with database, user and password creation.
Then go to the browser and search for:
http://localhost/wp-admin
WordPress installation page will show up. Start with the installation process.
If you face any dialog box that says that
Unable to write to wp-config.php file.
You can create the wp-config.php file manually and paste the following text into it.
Then copy the full text from the box. And go to terminal and type:
sudo cd /var/www/html
sudo nano wp-config.php
and paste the whole text you copied and ctrl+s to save and ctrl+x to close the window.
After the installation you can access your WordPress website from:
http://localhost
And also you can edit your website from:
http://localhost/wp-admin
Cloud Server
We will be using owncloud to provide data access using web interface. It also provides options to sync and share data across devices.
To enable cloud services we need to do the followings:
- Step 1 - Setup LAMP
- Step 2 - Download ownCloud Archive
- Step 3 - Create MySQL Database and User
- Step 4 - Install ownCloud with Web Installer
We are already done with Step - 1. So now we will start with step 2.
Step 2 - Download ownCloud Archive
cd /var/www/html
sudo wget https://download.owncloud.com/server/stable/owncloud-complete-latest.zip
Then unzip the latest.zip file :
sudo unzip owncloud-complete-latest.zip
cd /var/www/html
sudo chown -R apache.apache owncloud
sudo chmod -R 755 owncloud
Delete the .zip file
sudo rm owncloud-complete-latest.zip
Create MySQL database and user
mysql -u root -p
Enter Password:
create database owncloud;
grant all privileges on owncloud.* to "admin"@"%";
#as we have already created user admin with password "password"
exit
Now let’s go to web browser and search:
http://localhost/ownlcloud
You might encounter an error like :
This version of ownCloud is not compatible with PHP 8.0
You are currently running PHP 8.1.2.
That time, you need to downgrade your php. You need to go below php version 7.4.
To do that:
Remove php from your system
sudo yum remove php
Add REMI Repository
Run the command below to add REMI Repository to your system.
sudo yum -y install https://rpms.remirepo.net/fedora/remi-release-36.rpm
Install PHP 7.4 on Fedora
sudo dnf config-manager --set-enabled remi
sudo dnf module reset php
sudo dnf module install php:remi-7.4
Confirm current php version is installed:
php -v
Restart the apache again:
sudo systemctl restart httpd
Go to the web browser and search:
http://localhost/owncloud
You might face a write error. To solve that,
sudo setenforce 0
sudo nano /etc/selinux/config
# change the SELINUX=enforcing to SELINUX=permissive
then reboot the pc
After reboot, go to your web browser again search for:
http://localhost/owncloud
Mail Server
We will be using RoundCubeMail to set up our mail server. To do that:
Download the latest tarball of roundcube mail, untar it and move it to the /var/www/html/. and also change the ownership.
#download roundcubemail from roundcubemail website
cd /home/mdrafsunsheikh/Downloads
tar zxvf roundcubemail-0.8.6.tar.gz
mv roundcubemail-0.8.6 /var/www/html/roundcubemail
chown -R apache:apache /var/www/html/roundcubemail
Create a database for the roundcube mail
mysql -u root -p
CREATE DATABASE roundcubemail;
GRANT ALL PRIVILEGES ON roundcubemail.* TO "admin"@"%";
exit
Open the link in the browser:
http://localhost/roundcubemail/installer
Press Next then Check login.
Remove the installer directory.
rm -rf /var/www/html/roundcubemail/installer
Go to the link:
http://localhost/roundcubemail
You will get the roundcubemail login screen.
Install Mail Server using iRedMail in Ubuntu
Install Ubuntu in your PC first.
Download iRedMail installation file from its official website.
Go to your Downloads folder and extract the installed file
cd Downloads
tar -xzvf iRedMail-1.6.2.tar.gz
Go inside the extracted folder
cd iRedMail-1.6.2
Change the permission of the iRedMail.sh file to executable
chmod +x iRedMail.sh
install the iRedMail.sh file
sudo ./iRedMail.sh
provide your password.
You will face an error like
<< ERROR >> Please configure a fully qualified domain name (FQDN) in /etc/hosts before we go further.
Example:
127.0.0.1 mail.iredmail.org mail localhost
We need to configure our domain name. Before that lets change our hostname to mail for better assimilation
sudo hostname mail
Lets go to /etc/hosts and set our domain name
sudo nano /etc/hosts
#and change into following:
127.0.0.1 mail.service.xyz mail localhost
Then save the file with ctrl+s and exit with ctrl+x
Again try to install the iRedMail.sh file
sudo ./iRedMail.sh
Follow the following configuration
< Question > Use it for mail server setting? [y|N]
#Give y ;
1. Press enter to select Yes in Welcome and thanks for your use
2. In default mail storage path keep default and press "Enter"
3. In Preffered web server select "Nginx" and press "Enter"
4. In Choose preffered backend used to store mail accounts select "Mariadb" and press "Enter"
5. Set a password for MYSQL administrator : root
6. Input your domain name as service.xyz
7. Set a password for the mail domain administrator
8. In optional components keep everything as such and press NEXT
9. Type 'y' and press "enter" to start the installation
10. Question > File : /etc/firewalld/zones/iredmail.xml, with SSHD ports : 22 [y/n] Press Y
11. Restart firewall ? Press y
12. File > /etc/my.cnf. press Y
Your installation will be finished and there will be some configuration check as :
URLs of installed web applications:
- Roundcube webmail: https://mail.service.xyz/mail
- Netdata (monitor): https://mail.service.xyz/netdata
- Web admin panel (iRedmail): https://mail.service.xyz/iredmail
You can login to above links with below credentials:
-username: postmaster@service.xyz
- Password : <your given password>
You have to reboot your pc to enable all services
reboot
Congratulations! You are done with installing mail server using iRedMail. Now you can go to your web browser and search the Roundcube webmail URL or Web Admin Panel URL. Happy Coding!
Conclusion
You have come to the end of the tutorial. Some of the steps are clumsy. In those cases you need to be cautious. Please read the prompt up writings in the bash. You will be clear when you read them carefully. You may face many errors, so try to follow the steps meticulously. Hopefully you can be able to install and configure all the services successfully.
Please leave a comment if you face any problems. Thank you.
Posted on February 20, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.