Last active
April 1, 2023 04:17
-
-
Save amitkhare/846690c050db846965481ee9e6eeb520 to your computer and use it in GitHub Desktop.
Setup C9 IDE in digitalocean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Requirements | |
Putty prefered if you are in Windows. | |
JuiceSSH if you choose to do all this from android phone | |
https://play.google.com/store/apps/details?id=com.sonelli.juicessh | |
A digitalocean account, if you dont have one, create one with this link | |
https://bit.ly/do-credit | |
You will get $10 credit in you digitalocean account once you spend $25 with them. | |
create digitalocean account, verify it. | |
create droplet. | |
choose ubuntu 16.4 -> LAMP | |
choose server location | |
create droplet (5 Dollers) | |
digital ocean will send an email to your registered email id with Login 'root' username and password with server IP address. | |
copy ip address | |
open PuTTY, paste IP address, press connect, enter username and password ( sent you via email) | |
accept signature | |
Change your password, something you can remember. | |
cd into home | |
cd ~ | |
sudo apt-get update | |
install build essentials | |
sudo apt-get install build-essential | |
install node 8.x | |
cd ~ | |
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh | |
nano nodesource_setup.sh | |
sudo bash nodesource_setup.sh | |
sudo apt-get install nodejs | |
nodejs -v | |
check if you have firewall enabled and is there port 8080 listed in there | |
sudo ufw status | |
allow access to port 8080 to world (needed for e9) | |
sudo ufw allow 8080 | |
....................... Now real c9 instalation bigins. | |
cd ~ | |
git clone https://github.com/c9/core.git c9sdk | |
cd ~/c9sdk | |
scripts/install-sdk.sh | |
$ node server.js -w /var/www --port 8080 --listen 0.0.0.0 --auth <username>:<password> | |
Now open you browser and visit http://your.ip.address:8080 | |
enter username and password when prompted. | |
Yey! your personal cloud IDE. | |
############ taking one step further if you want to run you IDE 24x7, install forevejs and use it instead | |
$ cd ~/c9sdk | |
$ forever server.js -w /var/www --port 8080 --listen 0.0.0.0 --auth <username>:<password> | |
$ npm install forever -g | |
and if you want to also choose the working directory everytime you start ide.. | |
......................... create a file ~/bin/c9start.sh and paste c9start.sh file content in there | |
NOTE You should change user:password, this is your basic auth password and login | |
........................................................................................ | |
now make the file executable | |
$ sudo chmod +x ~/bin/c9start.sh | |
thats it. | |
Now everytime you want to swith directory or open a new project | |
just do | |
$ ~/bin/c9start.sh | |
thats it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
dirbase="/var/www/" | |
cd $dirbase | |
read -p "Enter project path: $dirbase" ddir | |
read -p "Enter Port (default:8080):" pport | |
pport=${pport:-8080} | |
ddir=${ddir:-''} | |
dirpath=$dirbase$ddir | |
if [ ! -e $dirpath ]; then | |
mkdir $dirpath | |
elif [ ! -d $dirpath ]; then | |
echo "$dirpath already exists but is not a directory" | |
exit | |
fi | |
cd $dirpath | |
echo "Your Project will run on port: $pport" | |
forever stopall | |
forever start /root/c9sdk/server.js -w "$dirpath" -p $pport -l 0.0.0.0 -a user:password | |
clear | |
echo "Your C9 project '$dirpath' is running on port $pport." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment