Announcement / YouTube Posts / Host a FiveM Server on Linux | Including MySQL and Apache | Google Cloud Platform
Posted: 1 year ago / May 11, 2021
Edited: 1 year ago / May 11, 2021
First You need to open the ports of your instance through GCP Control Panel (Shown in the video)
Setting Up Root Password (There is no default password of VM Instance in GCP)
sudo -i
sudo bash
sudo passwd root
Enable Root Login
sudo nano /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
sudo systemctl restart sshd
Disabling Firewall
sudo ufw disable
Installing Apache
sudo apt update
sudo apt install apache2
Open IP and See if apache is working
Installing MySQL
sudo apt install mysql-server
sudo mysql_secure_installation
Allow Remote Login
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
change localhost ip to 0.0.0.0
sudo systemctl restart mysql
creating new user in mysql
mysql -u root -p
CREATE USER 'newuser'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'%';
FLUSH PRIVILEGES;
exit
Now, you may test the mysql connection
Hosting FiveM
mkdir ~/fivem_server
cd ~/fivem_server
wget LINK (Reference)
tar -xvf fx.tar.xz
rm fx.tar.xz --DELETERARFILE
git clone https://github.com/citizenfx/cfx-server-data ~/fivem_resources
nano ~/fivem_resources/server.cfg
copy server cfg (Reference)
ctrl o
screen -s "FiveM server" bash ~/fivem_server/run.sh
Note:-
To switch screen (CTRL+A then D)
to shut down server, ctrl c
to switch screen screen -r