install DA on Google Cloud Platform Compute Engine

first connected as root with the command:

sudo -s

Next, stop the Firewall

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

nano /etc/default/grub

add quota options rootflags=usrquota,grpquota into the end of GRUB_CMDLINE_LINUX line, it will look like this

GRUB_CMDLINE_LINUX="crashkernel=auto console=ttyS0,38400n8 rootflags=usrquota,grpquota"


Make a backup

cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.back

Generate a new configuration file:

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

mount | grep '/'
/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

nano /etc/sysconfig/network-scripts/ifcfg-eth0:0

Enter the following content

DEVICE=eth0:0B
OOTPROTO=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

/etc/init.d/network restart

If you wish to you IPv6, set your eth0 live below:

IPV6INIT="yes"
IPV6ADDR=2600:1f16:xxxxxxxxxxxx

6. Setup DirectAdmin

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

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:

nano /etc/proftpd.conf

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

nano /usr/libexec/iptables/iptables.init

add $IPTABLES -A INPUT -p tcp –dport 35000:35999 -j ACCEPT below the ftp section, like this

########################## 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.

Last edited by HipHopServers; 01-10-2018 at 12:26 AM.

Share

You may also like...