Skip to content

Instantly share code, notes, and snippets.

@si458
Forked from allanmc/genieacs-install.sh
Last active April 22, 2020 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save si458/d3095c47339fad72ffaf5222dd7dbf49 to your computer and use it in GitHub Desktop.
Save si458/d3095c47339fad72ffaf5222dd7dbf49 to your computer and use it in GitHub Desktop.
Install GenieACS on Ubuntu 16.04
#!/bin/sh
set -e
# install all updates/upgrades to begin with
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
# install essential packages
sudo apt-get install -y build-essential git curl software-properties-common python-software-properties zlib1g-dev tmux libsqlite3-dev
# install nodejs
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
# install mongodb
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get install -y mongodb-org
# install GenieACS
git clone https://github.com/genieacs/genieacs.git
cd genieacs/
npm install
npm run configure
npm run compile
cd ..
# install ruby
sudo add-apt-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby2.5 ruby2.5-dev
# install bundler
gem install bundler
# install ruby on rails
gem install rails
#GenieACS GUI
git clone https://github.com/genieacs/genieacs-gui
cd genieacs-gui/
bundle
cp config/summary_parameters-sample.yml config/summary_parameters.yml
cp config/index_parameters-sample.yml config/index_parameters.yml
cp config/parameter_renderers-sample.yml config/parameter_renderers.yml
cp config/parameters_edit-sample.yml config/parameters_edit.yml
cp config/roles-sample.yml config/roles.yml
cp config/users-sample.yml config/users.yml
cp config/graphs-sample.json.erb config/graphs.json.erb
cd ..
cat << EOF > ./genieacs-start.sh
#!/bin/sh
if tmux has-session -t 'genieacs'; then
echo "GenieACS is already running."
echo "To stop it use: ./genieacs-stop.sh"
echo "To attach to it use: tmux attach -t genieacs"
else
tmux new-session -s 'genieacs' -d
tmux send-keys './genieacs/bin/genieacs-cwmp' 'C-m'
tmux split-window
tmux send-keys './genieacs/bin/genieacs-nbi' 'C-m'
tmux split-window
tmux send-keys './genieacs/bin/genieacs-fs' 'C-m'
tmux split-window
tmux send-keys 'cd genieacs-gui' 'C-m'
tmux send-keys 'rails server' 'C-m'
tmux select-layout tiled 2>/dev/null
tmux rename-window 'GenieACS'
echo "GenieACS has been started in tmux session 'geneiacs'"
echo "To attach to session, use: tmux attach -t genieacs"
echo "To switch between panes use Ctrl+B-ArrowKey"
echo "To deattach, press Ctrl+B-D"
echo "To stop GenieACS, use: ./genieacs-stop.sh"
fi
EOF
cat << EOF > ./genieacs-stop.sh
#!/bin/sh
if tmux has-session -t 'genieacs' 2>/dev/null; then
tmux kill-session -t genieacs 2>/dev/null
echo "GenieACS has been stopped."
else
echo "GenieACS is not running!"
fi
EOF
chmod +x genieacs-start.sh genieacs-stop.sh
echo
echo "DONE!"
echo "GenieACS has been sucessfully installed. Start/stop it using the following commands:"
echo "./genieacs-start.sh"
echo "./genieacs-stop.sh"
#sudo add-apt-repository -y ppa:chris-lea/redis-server
#sudo apt-get -y install redis-server
#sudo npm install -g coffee-script
#sudo npm install -g nodemon
#sudo chmod -R 777 ./tmp
@ojarmes
Copy link

ojarmes commented Dec 2, 2018

Ubuntu 16.04.5

Any tip for me?

Done.
Setting up mongodb-org-mongos (3.6.9) ...
Setting up mongodb-org-tools (3.6.9) ...
Setting up mongodb-org (3.6.9) ...
Cloning into 'genieacs'...
remote: Enumerating objects: 3088, done.
remote: Total 3088 (delta 0), reused 0 (delta 0), pack-reused 3088
Receiving objects: 100% (3088/3088), 1.08 MiB | 290.00 KiB/s, done.
Resolving deltas: 100% (2158/2158), done.
Checking connectivity... done.
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.

libxmljs@0.18.7 install /opt/genieacs/node_modules/libxmljs
node-pre-gyp install --fallback-to-build --loglevel http

node-pre-gyp http GET https://github.com/libxmljs/libxmljs/releases/download/v0.18.7/node-v57-linux-x64.tar.gz
node-pre-gyp ERR! Tried to download(undefined): https://github.com/libxmljs/libxmljs/releases/download/v0.18.7/node-v57-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for libxmljs@0.18.7 and node@8.14.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp http EACCES: permission denied, mkdir '/opt/genieacs/node_modules/libxmljs/build'
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.14.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/opt/genieacs/node_modules/libxmljs/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/opt/genieacs/node_modules/libxmljs/.node-gyp'
gyp ERR! System Linux 4.4.0-139-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--loglevel=http" "--module=/opt/genieacs/node_modules/libxmljs/build/Release/xmljs.node" "--module_name=xmljs" "--module_path=/opt/genieacs/node_modules/libxmljs/build/Release"
gyp ERR! cwd /opt/genieacs/node_modules/libxmljs
gyp ERR! node -v v8.14.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --loglevel=http --module=/opt/genieacs/node_modules/libxmljs/build/Release/xmljs.node --module_name=xmljs --module_path=/opt/genieacs/node_modules/libxmljs/build/Release' (1)
node-pre-gyp ERR! stack at ChildProcess. (/opt/genieacs/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.4.0-139-generic
node-pre-gyp ERR! command "/usr/bin/node" "/opt/genieacs/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--loglevel" "http"
node-pre-gyp ERR! cwd /opt/genieacs/node_modules/libxmljs
node-pre-gyp ERR! node -v v8.14.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --loglevel=http --module=/opt/genieacs/node_modules/libxmljs/build/Release/xmljs.node --module_name=xmljs --module_path=/opt/genieacs/node_modules/libxmljs/build/Release' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! libxmljs@0.18.7 install: node-pre-gyp install --fallback-to-build --loglevel http
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the libxmljs@0.18.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-12-02T13_19_58_989Z-debug.log

@youssefbj
Copy link

Hello Everyone !
I've tried this script on my Ubuntu 16.04 LTS yesterday .
When I lunch the script , i get error about mongodb-org , so i was obliged to lunch the script in some terminal command.
finally i get genieacs installed successfully . but when i lunch the script ./genieacs-start.sh with tmux session i got the following error
ubuntu:~$ ./genieacs/bin/genieacs-cwmp
/usr/bin/env: invalid option -- 'S'
Try '/usr/bin/env --help' for more information.

ubuntu:~$ ./genieacs/bin/genieacs-nbi
/usr/bin/env: invalid option -- 'S'
Try '/usr/bin/env --help' for more information.

ubuntu:$ ./genieacs/bin/genieacs-fs
/usr/bin/env: invalid option -- 'S'
Try '/usr/bin/env --help' for more information.
ubuntu:
$

I searched on the internet for some solution but i got nothing , can you help me please ?

@si458
Copy link
Author

si458 commented Jun 1, 2019

plz forgive for the late reply, i didnt realise people posted comments about this,
i forked this script and tried to modifiy it manually but i never got it working correctly and gave up in the end,
anybody wants to fork and create there own, go ahead :)

@Igor1404
Copy link

Hi. The commands npm compile and npm configure don't works.

@si458
Copy link
Author

si458 commented Apr 22, 2020

Hi. I never got this to work and gave up, your on your own now sadly :(

@holloo
Copy link

holloo commented Apr 22, 2020

Try it. This is my (fixed) method for Ubuntu 16.04.6 LTS. It worked fine about one year ago:

Save this script into the home directory as 'inst.sh'
Make 'inst.sh' executable
Run 'inst.sh' from home directory (as user, not as root: './inst.sh')


#!/bin/sh
set -e

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt autoremove -y
sudo apt-get install -y git curl tmux build-essential zlib1g-dev libsqlite3-dev redis-server mongodb npm ruby-bundler ruby-dev libxml2 libxml2-dev gcc g++ make

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

git clone https://github.com/genieacs/genieacs.git
cd genieacs
git checkout $(git tag -l v1.1.* --sort=-v:refname | head -n 1)
sed -i 's/"libxmljs": "^0.18.8"/"libxmljs": "^0.19.5"/' package.json
npm install
npm run compile

cd ..
git clone https://github.com/genieacs/genieacs-gui
cd genieacs-gui/
bundle

cp config/summary_parameters-sample.yml config/summary_parameters.yml
cp config/index_parameters-sample.yml config/index_parameters.yml
cp config/parameter_renderers-sample.yml config/parameter_renderers.yml
cp config/parameters_edit-sample.yml config/parameters_edit.yml
cp config/roles-sample.yml config/roles.yml
cp config/users-sample.yml config/users.yml
cp config/graphs-sample.json.erb config/graphs.json.erb
cd ~/genieacs-gui/db/migrate/

grep -rl "ActiveRecord::Migration$" *.rb | xargs sed -i 's/ActiveRecord::Migration/ActiveRecord::Migration[5.2]/g'
cd ~/genieacs-gui/
rake db:migrate

cd ..
cat << EOF > ./genieacs-start.sh
#!/bin/sh
if tmux has-session -t 'genieacs'; then
echo "GenieACS is already running."
echo "To stop it use: ./genieacs-stop.sh"
echo "To attach to it use: tmux attach -t genieacs"
else
tmux new-session -s 'genieacs' -d
tmux send-keys './genieacs/bin/genieacs-cwmp' 'C-m'
tmux split-window
tmux send-keys './genieacs/bin/genieacs-nbi' 'C-m'
tmux split-window
tmux send-keys './genieacs/bin/genieacs-fs' 'C-m'
tmux split-window
tmux send-keys 'cd genieacs-gui' 'C-m'
tmux send-keys 'rails server' 'C-m'
tmux select-layout tiled 2>/dev/null
tmux rename-window 'GenieACS'
echo "GenieACS has been started in tmux session 'geneiacs'"
echo "To attach to session, use: tmux attach -t genieacs"
echo "To switch between panes use Ctrl+B-ArrowKey"
echo "To deattach, press Ctrl+B-D"
echo "To stop GenieACS, use: ./genieacs-stop.sh"
fi
EOF

cat << EOF > ./genieacs-stop.sh
#!/bin/sh
if tmux has-session -t 'genieacs' 2>/dev/null; then
tmux kill-session -t genieacs 2>/dev/null
echo "GenieACS has been stopped."
else
echo "GenieACS is not running!"
fi
EOF

chmod +x genieacs-start.sh genieacs-stop.sh

echo
echo "DONE!"
echo "GenieACS has been sucessfully installed. Start/stop it using the following commands:"
echo "./genieacs-start.sh"
echo "./genieacs-stop.sh"
echo

cd ..
echo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment