This is the second in a series of posts about setting up and configuring an Azure virtual machine for use as a development box for Embarcadero’s RADStudio 10.2 Tokyo. In this blog post I will explain the steps necessary for properly configuring your new Linux virtual machine for use with RADStudio linux development.
For the first post in this series please visit Setup an Azure VM for RadStudio 10.2 Linux Development (Part 1)
Configure & Install Linux Packages
The first step in configuring your Ubuntu VM is to login to it with your favorite SSH client. On a Linux or Mac OS X machine this is easy. Simply open a terminal window and enter the following command:
where <admin_user> is the name of the administrator user you specified while creating your Azure VM and <ip_address> is the virtual machine’s public IP address you recorded as the last step of Part 1.
You will then be prompted to accept the key for the connection. (Depending on your SSH client this will only happen once and be saved, or you may be prompted each time you connect.) Simply answer YES to this prompt and you will be prompted to enter your password. Enter your password and you will be logged in to your virtual machine’s command prompt.
The next step is to ensure that your virtual machine’s operating system is up to date. To do so, enter the following commands into your SSH session:
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade
The first command, sudo apt-get update, downloads the latest information from the repositories and updates the os package list to make sure you are using the newest packages available. The second command, sudo apt-get upgrade, installs the newest versions of the packages on your virtual machine. And the thirst command, sudo apt-get dist-upgrade, ensures that all package dependencies are met by either installing new ones, or removing ones that are not needed.
Next you will install packages that are needed by RADStudio 10.2 Tokyo. To do so enter the following commands
sudo apt-get install joe wget p7zip-full curl sudo apt-get install openssh-server sudo apt-get install build-essential sudo apt-get install zlib1g-dev sudo apt-get install libcurl4-gnutls-dev
Configure & Install VSFTPD
You are going to need an FTP server to transfer files (such as PAServer) from your local machine to your Linux VM. There is an excellent write up about how to do this over at DigitalOcean.com titled How To Set Up vsftpd for a User’s Directory on Ubuntu 16.04. Check it out.
Configure & Install Apache (Optional)
If you are planning on creating Apache server modules with RADStudio then you will need to install and configure Apache. Installing Apache is accomplished with the following command:
sudo apt-get install apache2
To configure Apache you must add a line to the apache2.conf file. This is done with the following command:
sudo nano /etc/apache2/apache2.conf
You need to add the following line to the apache2.conf file:
where <fqdn or ip> is the fully-qualified domain name of the server, ie. www.domain.com, or the public ip address of the virtual machine.
ServerName <fqdn or ip>
Then you need to check Apache’s configuration. This can be done with the following command:
If everything is ok the system will respond with Syntax OK.
sudo apache2ctl configtest
The final step for configuring Apache is to restart the service. You can do that by entering the following command:
sudo systemctl restart apache2
Configure & Install MySQL (Optional)
Another option you may want to install is MySQL. You can install MySQL by running the following command:
This will install the necessary packages that are needed to allow development with MySQL as the database back end. After the packages install you will be prompted to enter and confirm the password for the root database user. Make sure you record the password you enter somewhere as you will need it later.
sudo apt-get install mysql-server mysql-client
After MySQL is installed you will most likely want to give yourself access to it remotely. While not recommended for production machines, you can give yourself remote root access by performing the following steps.
- Start the MySQL client by entering the following command:
after which you will be prompted for your root password. Enter the password you entered earlier.
mysql -u root -p
- Enter the following command to give yourself remote root access. (Again, do not do this on a production server.)
replacing <password> with your desired root remote access password. Alternatively you can also replace the % with your local IP address to grant access only from your computer.
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘<password>’; QUIT;
Configure & Install Desktop Components (Optional)
I recommend installing desktop components and a VNC server on your Ubuntu development server. The reason I recommend this is it will make it easier to test and debug your software on your Linux box. You can easily login to it using a VNC client which will allow you to see your file system easier and allow you to open multiple terminal windows. The desktop I installed is XFCE4. It is a lightweight desktop that works well over VNC.
To Install the Ubuntu desktop components enter the following commands:
sudo apt-get install ubuntu-desktop sudo apt-get install xfce4 xfce4-goodies
Next you will install a VNC server. I recommend using TightVNC server. You can install it with the following command:
sudo apt-get install tightvncserver
You now need to configure your VNC server. To begin this process you need to start and stop the server so that it will create the necessary config files in your home directory. This can be done with the following commands:
vncserver vncserver -kill :1
Now you should backup the vnc config file in case you make a mistake while editing it. Backing up is as simple as this:
cp ~/.vnc/xstartup ~/.vnc/xstartup.bak
You will now edit the config file
replacing the contents of that file with the following:
#!/bash xrdb $HOME/.Xresources startxfce4 &
Now you can check to make sure everything is configured correctly by entering the following command:
You will want to setup the VNC server to start automatically. This is done by setting it up as a system service. To create the service file enter the following command:
and copy the following into the file:
sudo nano /etc/systemd/system/vncserver@.service
[Unit] Description=Start TightVNC server at startup After=syslog.target network.target [Service] Type=forking User=<username> PAMName=login PIDFile=/home/<username>/.vnc/%H:%i.pid ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280×800 :%i ExecStop=/usr/bin/vncserver -kill :%i [Install] WantedBy=multi-user.target
Now that you have the service file created, the final step is to enable and start the service. You can do so by following the steps below:
sudo systemctl daemon-reload sudo systemctl enable email@example.com vncserver -kill :1 sudo systemctl start vncserver@1
Finally check the status of the running service to make sure everything is ok.
sudo systemctl status vncserver@1
That’s it for this post. Stay tuned, in the next and final post, I will show you how to configure the Azure firewall to allow you to remotely access the server for development purposes. I will also show you how to install InterBase 2017 Developer Edition and PAServer. And finally I will show you how to connect the RADStudio IDE to your development machine and configure it for use with your new server.