Update the system.
sudo apt-get update
sudo apt-get dist-upgrade
Install proftpd
.
sudo apt-get install proftpd
During installation, you will be asked if you want to install in inetd
or standalone
mode. Choose the standalone
mode.
Open the Proftpd configuration file.
sudo nano /etc/proftpd/proftpd.conf
The file will resemble the following text.
#
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes, reload proftpd after modifications, if
# it runs in daemon mode. It is not required in inetd/xinetd mode.
#
# Includes DSO modules
Include /etc/proftpd/modules.conf
# Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6 on
# If set on you can experience a longer connection delay in many cases.
IdentLookups off
ServerName "Debian"
ServerType standalone
DeferWelcome off
MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200
DisplayLogin welcome.msg
DisplayChdir .message true
ListOptions "-l"
DenyFilter \*.*/
# Use this to jail all users in their homes
# DefaultRoot ~
# Users require a valid shell listed in /etc/shells to login.
# Use this directive to release that constrain.
RequireValidShell off
# Port 21 is the standard FTP port.
Port 21
...
ServerName
: Specifies the name of the FTP server. This name will be displayed when clients connect to the server.TimeoutIdle
: The time, in seconds, after which a client is automatically disconnected if it is no longer active on the FTP server.DefaultRoot
: Controls the default root directory assigned to a user upon login.Port
: The connection port to the FTP server. Almost all of the time this port is 21
and you should not have to change it unless you are blocked by a firewall.PassivePorts
: Restricts the range of ports from which the server will select when sent the PASV
command from a client.MaxInstances
: The maximum number of simultaneous connections you want to allow on your FTP server.Now, we have to activate the DefaultRoot
option. to do this, find the DefaultRoot
commented line and uncomment it.
DefaultRoot ~
The value ~
means that the user will be limited to the personal folder (e.g /home/user12
).
Note: By default, someone who connects to the FTP server can access all of the server folders, so it’s recommended to enable the option DefaultRoot
.
Change the ServerName
.
ServerName : the name of your FTP server
Find and uncomment the following lines (removing the #
at the beginning of each line) to allow anonymous connections to your server.
# A basic anonymous configuration, no upload directories.
<Anonymous ~ftp>
User ftp
Group nogroup
# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp
# Cosmetic changes, all files belongs to ftp user
DirFakeUser on ftp
DirFakeGroup on ftp
RequireValidShell off
# Limit the maximum number of anonymous logins
MaxClients 10
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayFirstChdir .message
# Limit WRITE everywhere in the anonymous chroot
<Directory *>
<Limit WRITE>
DenyAll
</Limit>
</Directory>
</Anonymous>
Note: If you enable anonymous connections on your FTP server, any user can connect to it. They will have access to the /home/ftp
directory and will be able to read and download files, but not modify or add files.
You can forbid the root user from accessing FTP by adding the following line.
RootLogin off
After the configuration has been changed, restart the server.
sudo service proftpd restart
Note: If an error line is displayed as “unable to resolve host”, be aware that it does not matter and you can ignore it.
Add a user, for example, “myuser
“.
useradd --shell /bin/false myuser
Create the home directory of our user “myuser
“.
mkdir /home/myuser
Change the ownership of that directory to the user and group “myuser
“.
chown myuser:myuser /home/myuser/
Set a password for the user “myuser
“.
passwd myuser
]]>This tutorial explains how to install Ruby, using RVM, on Ubuntu 18.04 and Ubuntu 19.10. Ruby is a popular development language. RVM manages multiple Ruby environments and allows you to switch between them.
$ sudo apt install gnupg
Import the RVM code-signing keys. The command below is an example, please verify the keys at https://rvm.io/rvm/security.
$ gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Go to the /tmp
folder
$ cd /tmp
Download a stable version of the RVM script.
$ sudo apt-get update && apt-get install curl && curl -sSL https://get.rvm.io | bash -s stable
Add your user account to the rvm group.
$ sudo usermod -a -G rvm username
Log out of your terminal, then log back in again. Group memberships are only evaluated at login time.
Check the RVM version.
$ rvm -v
rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
Example: List the known Ruby versions
$ rvm list known
Example: Install a specific version of Ruby.
$ rvm install ruby-2.7.0
$ rvm --default use ruby-2.7.0
Example: Remove a specific version of Ruby.
$ rvm remove ruby-2.7.0
Example: Check the Ruby versions installed with RVM.
$ rvm list
Example: Check the Ruby version.
$ ruby -v
Example: Remove a specific version of Ruby.
$ rvm remove ruby-2.7.0
$ sudo rvm implode $ sudo rm -rf ~/.rvm $ sudo rm -rf /etc/rvmrc $ sudo rm -rf ~/.rvmrc $ sudo groupdel rvm
.bashrc
, .bash_profile
, .profile
, and .zshrc
files.RVM is a simple way to manage multiple Ruby environments. For more information, see the RVM homepage.
]]>Apache Maven is a free and open source project management tool used for Java projects. You can easily manage a project’s build, reporting, and documentation from a central piece of information using Apache Maven. Apache Maven provides a complete framework to automate the project’s build infrastructure.
In this tutorial, you will learn how to install Apache Maven on Ubuntu 18.04.
First, update your system to the latest stable version:
sudo apt-get update -y
sudo apt-get upgrade -y
Maven 3.3 or greater requires JDK 1.7 or above to be installed. We will install OpenJDK, which is the default Java development and runtime in Ubuntu 18.04.
Install OpenJDK:
sudo apt-get install -y default-jdk
Verify the Java version:
java -version
The output will be similar to the following:
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.3)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.3, mixed mode)
First, change your working directory to the /opt/
directory:
cd /opt/
You can download the latest stable version of Apache Maven from the official website:
sudo wget https://www-us.apache.org/dist/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz
Once the download has completed, extract the downloaded archive:
sudo tar -xvzf apache-maven-3.6.0-bin.tar.gz
Next, rename the extracted directory:
sudo mv apache-maven-3.6.0 maven
Next, you will need to setup the environment variables such as M2_HOME
, JAVA_HOME
and PATH
. You can do this by creating a mavenenv.sh
file inside of the /etc/profile.d/
directory:
sudo vi /etc/profile.d/mavenenv.sh
Add the following lines:
export JAVA_HOME=/usr/lib/jvm/default-java
export M2_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
Save and close the file, and make it executable:
sudo chmod +x /etc/profile.d/mavenenv.sh
Now you can load the environment variables:
source /etc/profile.d/mavenenv.sh
Once everything has been successfully configured, check the version of Apache Maven:
mvn --version
You will see a similar output to the following:
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T18:41:47Z)
Maven home: /opt/maven
Java version: 10.0.2, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-36-generic", arch: "amd64", family: "unix"
Congratulations, you have successfully installed Apache Maven on your Ubuntu 18.04 server. To get started using Maven, visit the official Apache Maven documentation.
]]>Mosquitto is an open source message broker (or server) that implements MQTT protocols. With its good community support, documentation, and ease of installation it has become one of the most popular MQTT brokers.
root
accessTCP:1883
on firewallUpdate Ubuntu’s package list and install the latest Mosquitto Broker available from it
sudo apt-get update
sudo apt-get install mosquitto
The Mosquitto service will start after installation.
sudo apt-get install mosquitto-clients
Mosquitto clients help us easily test MQTT through a command line utility. We will use two command windows, one to subscribe to a topic named "test"
and one to publish a message to it.
Topics are labels used by the broker to filter messages for each connected client. A client program subscribed to a topic "Home1/BedroomTemp"
will only listen to messages published to the same topic by other clients.
"test"
mosquitto_sub -t "test"
Mosquito_sub
is a subscribe client we installed in the previous command. Here we are specifying “-t
” followed by a topic name.
"test"
Login to the terminal as a second instance and publish a message to the "test"
topic.
mosquitto_pub -m "message from mosquitto_pub client" -t "test"
Here the additional parameter “–m
” is followed by the message we want to publish. Hit “Enter
” and you should see a message from mosquitto_pub client
displayed in other terminal where mosquito_sub client
is running.
Mosquitto comes with a password file generating utility called mosquitto_passwd
.
sudo mosquitto_passwd -c /etc/mosquitto/passwd dave
Password: password
Create a configuration file for Mosquitto pointing to the password file we have just created.
sudo nano /etc/mosquitto/conf.d/default.conf
This will open an empty file. Paste the following into it.
allow_anonymous false
password_file /etc/mosquitto/passwd
Save and exit the text editor with “Ctrl+O
“, “Enter
” and “Ctrl+X
“.
Now restart Mosquitto server and test our changes.
sudo systemctl restart mosquitto
In the subscribe client window, press “Ctrl+C
” to exit the subscribe client and restart it with following command.
mosquitto_sub -t "test" -u "dave" -P "password"
Note the capital -P here.
In the publish client window, try to publish a message without a password.
mosquitto_pub -t "test" -m "message from mosquitto_pub client"
The message will be rejected with following error message.
Connection Refused: not authorised.
Error: The connection was refused.
Now publish a message with the username
and password
.
mosquitto_pub -t "test" -m "message from mosquitto_pub client" -u "dave" -P "password"
Hit “Enter
” and you will see the message in subscribe client window, as in Step Two.
We have now set up a password protected MQTT server. You can use the Public IP of your Ubuntu server as an MQTT broker for your projects.
]]>First, update the list of packages:
sudo apt-get update -y
Next, install the updates:
sudo apt-get upgrade -y
Ubuntu ships with sudo
installed, so the first step will be to simply add a new user:
adduser <username>
You will be asked to set information about this user:
Enter the new value, or press ENTER for the default
Full Name []: Test User
Room Number []: 01
Work Phone []: 5555555
Home Phone []: 5555555
Other []:
You can fill these fields in, or press ENTER to leave them default. After this press Y and then ENTER to verify that the information is correct.
Next, add the new user to the sudo
group:
usermod -aG sudo <username>
You can now log out, and log back in as your new user. To test that the user was added correctly, use the following command once you have logged back in as the new user:
ls -la /root
You will receive the following notice:
ls: cannot open directory '/root': Permission denied
When you append the previous command with sudo
, you will be asked for your password and receive a list of the /root
directory:
sudo ls -la /root
You can now move onto updating Ubuntu.
You can use Apache or Nginx as your webserver.
To install and start Apache:
sudo apt-get install apache2 -y
sudo systemctl start apache2.service
To install and start Nginx:
sudo apt-get install nginx -y
sudo systemctl start nginx.service
PHP 7.2 is included in the default Ubuntu repository for 18.04. You can list each of the available PHP 7.2 packages with the following command:
apt-cache pkgnames | grep php7.2
Next, install the packages that your application requires:
sudo apt-get install php -y
sudo apt-get install php-{bcmath,bz2,intl,gd,mbstring,mysql,zip,fpm} -y
Finally, restart your webserver to allow PHP to run.
For Apache, use the following:
systemctl restart apache2.service
Alternatively, use the following for Nginx:
systemctl restart nginx.service
Confirm the PHP version:
php -v
The output will resemble the following:
PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
The main config file of PHP 7.2 will be saved as /etc/php/7.2/fpm/php.ini
. You can use the vi
text editor to modify relevant settings in that file:
sudo vi /etc/php/7.2/fpm/php.ini
Note: Remember to restart Apache or Nginx if you make any changes to that file or any other PHP config files.
You have successfully set up PHP 7.2 on Ubuntu 18.04 to work with either Nginx or Apache. You are now ready to customize your configurations and deploy your apps.
]]>Icecast is a popular and flexible solution for streaming audio used primarily for Internet radio stations. It supports Ogg, MP3, Opus and WebM streaming formats over HTTP, SHOUTcast, AAC and NSV. It has been in active development for 20 years and it is popular for its reliability, simplicity and adherence to open standards. It is released as free software under the GNU GPLv2 license.
Update the APT package list:
sudo apt-get update
Install Icecast:
sudo apt-get install icecast2
Right after installing the package an automated configuration window will open. Select Yes
to configure Icecast, and follow the prompts.
Icecast can be further configured editing the XML configuration file /etc/icecast2/icecast.xml
. The following is an example of how to change the port.
The port can be modified by editing the <port>
tag. It is set to 8000
by default:
<port>DESIRED_PORT_NUMBER</port>
Save and exit the file.
Note: To apply the configuration changes you need to restart Icecast.
Further documentation about Icecast config files can be found here.
If you want to run Icecast Server over privileged ports like HTTP
(80
) and HTTPS
(443
) you need to do some extra configuration.
Open the config file:
sudo vi /etc/icecast2/icecast.xml
Find the <security>
section. Uncomment the <changeowner>
section inside and make the following changes:
<security>
<chroot>0</chroot>
<changeowner>
<user>icecast2</user>
<group>icecast</group>
</changeowner>
</security>
We also need to tell the operating system to launch Icecast as root.
Open the service file:
sudo vi /etc/default/icecast2
Modify the USERID
and GROUPID
options so they match the following:
USERID=root
GROUPID=root
To start the Icecast Server:
sudo systemctl start icecast2
To restart and reload configuration changes:
sudo systemctl restart icecast2
To stop Icecast:
sudo systemctl stop icecast2
Icecast comes with a web interface that serves the audio streams as files. It includes an admin section which lets you see basic information and statistics. You can access it by navigating your web browser to your server address or domain and the port, http://ADDRESS:PORT
or http://example.com:PORT
.
Once the Icecast Server is setup you can use any of the compatible Icecast Clients, (also known as Source Clients), to transmit audio to the Icecast Server and to all the listeners. Usually the Source Client is installed remotely in the location where the audio is going to be transmitted but can be installed together with the Server if needed. There are a variety of options from free and open source applications like mixxx for DJs, IceS for complex automated setups and BUTT for simple microphone sharing; as well as many closed source solutions. A list of free and open source Source Clients can be found at Icecast’s app list
The scope of what Icecast is capable of doing is far beyond this basic setup. Visit the Icecast documentation to explore all the features that it offers, such as: stream relaying, advanced authentication, transcoding, public radio listings and more.
]]>This tutorial explains how to install a video conferencing service on an Ubuntu 18.04 LTS server instance using Jitsi Meet.
xxx.xxx.xxx.xxx
.jitsimeet.example.com
pointed to the server instance mentioned above.Note: When deploying on your server instance, be sure to replace all example values with your actual ones.
For a machine with 2GB of memory, it’s recommended to set up a 2GB (2048M) swap partition to improve system performance.
sudo dd if=/dev/zero of=/swapfile count=2048 bs=1M
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
free -m
Note: If you are using a different server size, the swap partition size may vary.
You need to correctly set up a hostname and an FQDN for the machine before you can enable HTTPS security by deploying a Let’s Encrypt HTTPS certificate.
The following commands will set up a hostname, jitsimeet
, and an FQDN, jitsimeet.example.com
, for the machine:
sudo hostnamectl set-hostname jitsimeet
sudo sed -i 's/^127.0.1.1.*$/127.0.1.1 jitsimeet.example.com jitsimeet/g' /etc/hosts
Confirm the results:
hostname
hostname -f
As required by Jitsi Meet, you need to allow OpenSSH
, HTTP
, and HTTPS
traffic, along with inbound UDP traffic on port 10000
through port 20000
:
sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw allow in 10000:20000/udp
sudo ufw enable
When you see the prompt Command may disrupt existing ssh connections. Proceed with operation (y|n)?
, input y
and then press ENTER.
For security and performance purposes, its necessary to update the Ubuntu 18.04 LTS system to the latest status:
sudo apt update
sudo apt upgrade -y && sudo shutdown -r now
You may be informed that the currently installed version of the grub configuration file has been locally modified during the upgrade. Since we are not responsible for the modification, use the UP arrow to highlight the install the package maintainer's version
option, and then press ENTER.
After the system reboot, log back in as the same sudo user to move on.
Jitsi Meet requires Java Runtime Environment and GNU Privacy Guard.
sudo apt install -y gnupg
sudo apt install -y openjdk-8-jre-headless
After OpenJDK JRE 8 installed, use the following command to verify the result:
java -version
The output will be similar to the following:
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
In addition, you can setup the JAVA_HOME
environment variable as follows:
echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
source /etc/profile
To better serve Jitsi Meet, you can install an Nginx web server before actually installing Jitsi Meet:
sudo apt install -y nginx
sudo systemctl start nginx.service
sudo systemctl enable nginx.service
You don’t need to manually configure Nginx because the Jitsi Meet installer will deal with this job for you later.
Note: If Nginx or Apache is not in place, the Jitsi Meet installer will automatically install Jetty along with the Jitsi Meet program.
On a modern Ubuntu or Debian system, you can easily install Jitsi Meet using the official Jitsi deb repo.
First setup the Jitsi repository on your system:
cd
wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -
sudo sh -c "echo 'deb https://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.list"
sudo apt update -y
Then install the full suite of Jitsi Meet:
sudo apt install -y jitsi-meet
During the installation, when you are asked to provide the hostname of the current installation, type in the FQDN jitsimeet.example.com
you set up earlier and then press ENTER.
When you are asked about the SSL certificate, highlight the Generate a new self-signed certificate (You will later get a chance to obtain a Let's Encrypt certificate)
option and then press ENTER.
After Jitsi Meet is successfully installed, use the following script to apply for a Let’s Encrypt SSL certificate:
sudo /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh
During the process, input your email admin@example.com
as prompted and then press ENTER. This script will automatically handle any tasks related to the Let’s Encrypt SSL certificate.
Finally, point your favorite web browser to http://jitsimeet.example.com
or https://jitsimeet.example.com
to access your Jitsi Meet Video conferencing service. Feel free to explore the interface. Clicking the GO
button will immediately create a Video conferencing channel for you.
To make sure that all of Rust’s dependencies are up-to-date, run the following commands.
apt-get update
apt-get dist-upgrade -y
apt-get install curl
Installing Rust is a simple process. Run the following command to launch their installation script.
curl -sSf https://static.rust-lang.org/rustup.sh | sh
When the script finishes, Rust will be installed.
To verify that Rust was successfully installed, run rustc -V
. You will see output similar to:
rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)
To use Rust, create a file called main.rs
and populate it with the following lines of code:
fn main() {
println!("You have successfully installed rust!");
}
Now run rustc main.rs
. You will see an executable file called main
in the same directory. Execute it by running ./main
. The text “You have successfully installed Rust!” will appear on your screen.
If you do not have Golang installed, install Golang using the directions in this article. This may also work on other distros but results will vary.
You can skip this step if you have already installed the version controls. Golang will require you to install git
, bzr
, and/or mercurial
. This may be needed if you are downloading libraries from a version control system that is using one of those protocols.
apt-get update
apt-get dist-upgrade -y
apt-get install git bzr mercurial -y
Once everything is installed, you can proceed to the next step.
To install Tango, run the following command:
go get github.com/lunny/tango
If everything went well, you can proceed to the next step. If there was an error, verify your GOPATH
by running go env
and checking its path. If your project is outside of the GOPATH
, and you get a warning about it, you can safely ignore it.
To use Tango, create a file called server.go
and populate it with the following lines of code:
package main
import (
"github.com/lunny/tango"
)
func main() {
t := tango.Classic()
t.Get("/", func() string {
return "Hello from AKLWEB HOST Server!"
})
t.Run()
}
Afterwards, run go run server.go
.
Switch over to your web browser and type http://[SERVER_IP]:8000/
. Replace [SERVER_IP]
with the IP address of your VPS.
If your installation was successful, you will see “Hello from AKLWEB HOST Server!” in your browser.
]]>It is recommended to run all commands as a user with sudo privileges that is not root.
Start by ensuring that your server is up to date.
sudo apt-get update && sudo apt-get upgrade -y
Install the needed packages.
sudo apt-get install git openjdk-7-jre tar -y
Allocate the desired amount of memory. Replace 1G accordingly.
sudo fallocate -l 1G /swapfile
Secure the permissions of your new swap file.
sudo chmod 600 /swapfile
Allocate the swap space.
sudo mkswap /swapfile
Turn on swap.
sudo swapon /swapfile
Make your swap file permanent. Add the line below to the bottom of the fstab
file.
sudo nano /etc/fstab
/swapfile none swap sw 0 0
Ensure you are in the home directory of the user used for installing Spigot.
cd ~
Create a folder for BuildTools.
mkdir build
cd build
Download BuildTools.jar Look for updates on their Jenkins page.
wget -O BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
Configure git.
git config --global --unset core.autocrlf
Run BuildTools.jar.
java -jar BuildTools.jar
Make note of the name of your spigot.jar
file. For example, spigot-1.8.3.jar
.
ls
Make a directory for your server.
cd ~
mkdir server
cd server
Move your spigot.jar
into your server directory. Replace spigotname.jar
with the name of your file.
mv ~/build/spigotname.jar ~/server/spigot.jar
Create a start up script for your server.
nano start.sh
Make start.sh
match the following, replacing -Xmx1024M
with the amount of RAM installed on your server.
#!/bin/sh
java -Xms512M -Xmx1024M -XX:MaxPermSize=128M -jar spigot.jar
Make start.sh
executable.
chmod +x start.sh
Start your server.
./start.sh
Install screen.
sudo apt-get install screen -y
Open an instance of screen.
screen -S "Spigot Server"
Start your server script.
~/server/start.sh
Accept EULA.
If you are asked to confirm eula.txt
, change eula
to true
.
nano eula.txt
BuildTools.jar wont run?
You need more RAM on your server or a larger swap file.
start.sh can’t run the file
command on your jar file?
Check to ensure everything is typed exactly the same, Linux IS case sensitive.
Want to download a specific Minecraft version?
java -jar BuildTools.jar --rev 1.8.4
Replace 1.8.4 with the version of your choice.
]]>