Skip to content

Instantly share code, notes, and snippets.

@lexavey
Last active November 14, 2022 10:01
Show Gist options
  • Save lexavey/cef966f076e5db35446676633dd3b069 to your computer and use it in GitHub Desktop.
Save lexavey/cef966f076e5db35446676633dd3b069 to your computer and use it in GitHub Desktop.
Install and configure Cloud9IDE in Ubuntu Server
## update and install all depencies
sudo apt-get update && sudo apt-get -y install curl git build-essential && sudo dpkg --configure -a
## if something error happen, try upgrade (sudo apt upgrade)
## Install Python2.7
sudo apt install python2.7 -y
## add c9 users and skip password
adduser --disabled-password --gecos "" c9user
echo 'c9user ALL=(ALL) NOPASSWD:ALL' | sudo EDITOR='tee -a' visudo
## cloning git and install
sudo -H -u c9user bash -c 'git clone https://github.com/lexavey/c9core /home/c9user/c9'
sudo -H -u c9user bash -c 'bash /home/c9user/c9/scripts/install-sdk.sh'
## create project directory
sudo -H -u c9user bash -c 'mkdir ~/my-projects'
## test running c9, if you dont have problem, next we add to service
#/home/c9user/.c9/node/bin/node /home/c9user/c9/server.js -p 8080 -a admin:admin --listen 0.0.0.0 -w /home/c9user/my-projects
## add service to systemd
## sudo nano /lib/systemd/system/c9.service
##then add this
sudo cat << EOF >/lib/systemd/system/c9.service
# Run:
# - systemctl enable c9
# - systemctl {start,stop,restart} c9
#
[Unit]
Description=c9
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/home/c9user/.c9/node/bin/node /home/c9user/c9/server.js -a admin:jancok123 -w /home/c9user/my-projects
Environment=NODE_ENV=production PORT=8080
User=c9user
Group=c9user
UMask=0002
Restart=on-failure
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=c9
[Install]
WantedBy=multi-user.target
EOF
##then reload
sudo systemctl enable c9.service
sudo systemctl daemon-reload
sudo service c9 start
@echo off
title This is c9
echo WSL Runner
for /f "usebackq delims=" %%i in (`
bash -c 'wslpath -a "%cd%"'
`) do set currentdir=%%i
set node_dir=~/.c9/node/bin/node
set js_dir=~/c9/c9/server.js
set port=8989
set listen=0.0.0.0
set username=admin
set password=jancok123
echo Node Dir : %node_dir%
echo JS Dir : %js_dir%
echo Login : %username% %password%
echo Unix DIR : %currentdir%
echo Execute : bash -c "%node_dir% %js_dir% --auth %username%:%password% -w '%currentdir%' --port %port% --listen %listen% --cache false"
bash -c "%node_dir% %js_dir% --auth %username%:%password% -w '%currentdir%' --port %port% --listen %listen% --cache false"
echo Done Exit
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment