I tried a few times to install DA on Google Cloud Platform Compute Engine. After a lot of Google search and this post. I looked up the workaround of DA to run on AWS. Since the two platforms are not configured in the same way this process was trial and error. So the success to install the script without connection errors was after. I first connected as root with the command:
Next, stop the Firewall
Code:
systemctl mask firewalld
systemctl stop firewalld
Then I followed on CentOS 7, xfs is used by default and Quotas are not activated, so you need to enable them manually
add quota options rootflags=usrquota,grpquota into the end of GRUB_CMDLINE_LINUX line, it will look like this
Code:
GRUB_CMDLINE_LINUX="crashkernel=auto console=ttyS0,38400n8 rootflags=usrquota,grpquota"
Make a backup
Code:
cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.back
Generate a new configuration file:
Code:
grub2-mkconfig -o /boot/grub2/grub.cfg
Restart the server, the root directory will be mounted with required options. We can check by running this command
Code:
/dev/xvda1 on / type xfs (rw,relatime,attr2,inode64,usrquota,grpquota)
Add network eth0:0
By default, GCP use private IP for eth0, to install DirectAdmin, we need to use the public IP
Code:
nano /etc/sysconfig/network-scripts/ifcfg-eth0:0
Enter the following content
Code:
DEVICE=eth0:0
BOOTPROTO=none
ONPARENT=yes
IPADDR=xxx.xxx.xxx.xxx
NETMASK=255.255.255.0
ONBOOT=yes
where xxx.xxx.xxx.xxx is your AWS Public IP, then restart the network
Code:
/etc/init.d/network restart
If you wish to you IPv6, set your eth0 live below:
Code:
IPV6INIT="yes"
IPV6ADDR=2600:1f16:xxxxxxxxxxxx
6. Setup DirectAdmin
Code:
echo 1 > /root/.lan
wget http://www.directadmin.com/setup.sh
chmod 755 setup.sh
./setup.sh
And follow the instructions. Note when you asked for the network, enter eth0:0
Configuration
Since GCP run on a LAN/NAT and behind the firewall, we need to do some config.
Enable LAN
Code:
nano /usr/local/directadmin/conf/directadmin.conf
Add this value lan_ip=yyy.yyy.yyy.yyy where yyy.yyy.yyy.yyy is your GCP Private IP
Link the Private IP to your Public IP using the DA Linked IP feature
- Add the LAN IP to DA's IP manager. Don't assign it to any Users or Domains.
- View the details of the external IP: Admin Level -> IP Manager -> Click the public/external IP.
- Link the internal IP to the external IP: Select the LAN IP from the drop down.
- Only select Apache, do not select DNS
Restart DirectAdmin
Open ports for FTP
I like to use (
https://www.configserver.com/cp/csf.html) to manage my firewall settings on command line and via DA.
If you use ProFTPD, edit it's configure file:
Add after PassivePorts: MasqueradeAddress xxx.xxx.xxx.xxx where xxx.xxx.xxx.xxx is your AWS Public IP
Add rule to the iptables
iptables -I INPUT -p tcp --dport 35000:35999 -j ACCEPT
Code:
nano /usr/libexec/iptables/iptables.init
add $IPTABLES -A INPUT -p tcp --dport 35000:35999 -j ACCEPT below the ftp section, like this
Code:
#########################
# ftp
$IPTABLES -A INPUT -p tcp --dport 21 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 35000:35999 -j ACCEPT
I compile this how to from several different sites and merged them into one which I use get my instance running with DA. My only issue is I am not sure how fix any issues that maybe caused when the instance reboots. Both AWS and GCP reset the hostname to their system default. There is suppose to be a way to set this at boot but I think you have to make a bash script then call to it at boot using the execute script option on both cloud platforms.