check_latest_version && sudo apt update && sudo apt upgrade -y
Identify what is using the port:
sudo netstat -tulpn | grep :port
sudo ss -tulpn | grep :port
sudo lsof -i :port
Terminate the process using the port:
sudo kill -9 process_id
sudo pkill -f process_name
sudo fuser -k port/tcp
Start service on alternative port:
service --port 8081
python -m http.server 8080
nginx -c config_with_different_port
Configure socket options:
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
sysctl net.ipv4.tcp_tw_reuse=1
EADDRINUSE occurs when trying to bind to a network address (IP:port) that is already in use.
netstat -an | grep TIME_WAIT
ss -s
cat /proc/net/tcp
iptables -L -n