This guide will walk you through setting up a chatroom server using Ubuntu Server on VirtualBox, and making it accessible over the internet using ngrok.
- Ubuntu Server (recommended) or other Linux distribution
- Python 3.6+
- Internet connection
- Windows: Use the provided executable
- Other platforms: Python 3.6+ with required dependencies
Visit the official VirtualBox download page and download the appropriate version for your operating system:
Install VirtualBox by following the installation wizard for your operating system.
Download the latest Ubuntu Server ISO file:
Choose the LTS (Long Term Support) version for better stability.
Follow this process to install Ubuntu Server:
- Open VirtualBox and create a new virtual machine
- Allocate appropriate resources (minimum 2GB RAM, 20GB disk space)
- Mount the downloaded Ubuntu Server ISO file
- Follow the installation wizard
- Make sure to install OpenSSH server during installation
- Complete the installation and reboot the VM
For a detailed visual guide, you can follow this tutorial:
Once installed, SSH into your server using the following command in your terminal:
ssh username@server_ip_addressReplace username with your Ubuntu username and server_ip_address with the IP address of your virtual machine.
First, update your system packages:
sudo apt-get updateInstall Git on your Ubuntu Server:
sudo apt-get install -y gitClone the chatroom application repository:
git clone https://github.com/Banshee099/chatroom.gitChange your working directory to the cloned repository:
cd chatroomGive execution permission to the server setup script:
sudo chmod +x server_setup.shGive execution permission to the ngrok setup script:
sudo chmod +x ngrok.shExecute the server setup script to install dependencies and configure the chat server:
sudo ./server_setup.shThis script will set up the Python environment, install dependencies, and create a system service for your chat server.
- Visit the ngrok dashboard and sign up or log in:
- Copy your authentication token from the dashboard
- Configure ngrok with your token:
ngrok config add-authtoken TOKENReplace TOKEN with your actual ngrok authentication token.
Execute the ngrok setup script to create a tunnel to your chat server:
sudo ./ngrok.shThis script will set up ngrok as a system service to expose your chat server to the internet.
Retrieve the public URL that ngrok has assigned to your server:
curl http://localhost:4040/api/tunnels | grep -o "tcp://[^\"]*"This will output something like:
tcp://0.tcp.in.ngrok.io:16704
Note: Your port number may be different than 16704.
You have two options for running the client:
Navigate to the client/dist folder and run client.exe.
Run the client using Python:
python client.pyOnce the client is running, connect to your server using the command:
/connect <username> <Public ngrok URL>
For example:
/connect JohnDoe tcp://0.tcp.in.ngrok.io:16704
Your chat client should now connect to your server, and you can start chatting!
-
If you can't connect to the server, check that both the chat server and ngrok services are running:
sudo systemctl status chat.service sudo systemctl status ngrok.service
-
Make sure your firewall settings allow connections on the required ports.
-
If the ngrok URL doesn't work, try restarting the ngrok service:
sudo systemctl restart ngrok.service
-
Check the ngrok logs if you encounter issues:
sudo journalctl -u ngrok.service
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.