-
-
Save RodolVelasco/50658e3df15cf53aae2b178718248338 to your computer and use it in GitHub Desktop.
sudo apt-get install | |
sudo apt-get update |
Installing Nodejs
Also including: Linux Mint, Linux Mint Debian Edition (LMDE), elementaryOS, bash on Windows and others.
Node.js is available from the NodeSource Debian and Ubuntu binary distributions repository (formerly Chris Lea's Launchpad PPA). Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.
NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 6.x on older distros.
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
Alternatively, for Node.js 10:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
Optional: install build tools
To compile and install native addons from npm you may also need to install build tools:
sudo apt-get install -y build-essential
nodejs --version
Changing apt-get update priority package to download in debian
Late to the party:
Originally I was running into the frustration that no matter what I did apt-cache policy nodejs would always output this:
nodejs:
Installed: (none)
Candidate: 4.8.2~dfsg-1
Version table:
4.8.2~dfsg-1 500
500 http://debian.csail.mit.edu/debian stretch/main amd64 Packages
500 http://ftp.de.debian.org/debian stable/main amd64 Packages
After much frustration this is what worked for me:
Update your sourcelist to include the node version you want. In my case I wanted the latest which is currently ```
https://deb.nodesource.com/node_9.x
sudo vim /etc/apt/source.list
Add the two following lines to the source list and save the file, for vim press esc and :wq
deb https://deb.nodesource.com/node_9.x stretch main
deb-src https://deb.nodesource.com/node_9.x stretch main
Run sudo apt-get update so the source lists refresh. critical step missing from the above comments
Check for the new apt-cache versions of node
apt-cache policy nodejs
> nodejs:
Installed: (none)
Candidate: 9.11.1-1nodesource1
Version table:
9.11.1-1nodesource1 1002
1002 https://deb.nodesource.com/node_9.x stretch/main amd64 Packages
6.14.1-1nodesource1 1002
1002 https://deb.nodesource.com/node_6.x stretch/main amd64 Packages
4.8.2~dfsg-1 500
500 http://debian.csail.mit.edu/debian stretch/main amd64 Packages
500 http://ftp.de.debian.org/debian stable/main amd64 Packages
Install node!
sudo apt install -y nodejs
verify install
nodejs -v
v9.11.1
npm -v
5.6.0
Downgrade from PHP 7.0 to PHP 5.6
Removing php7
sudo apt-get remove -y --purge php7.0*
Installing php5.6
sudo apt-get update
sudo apt-get install -y apt-transport-https curl
curl https://packages.sury.org/php/apt.gpg | sudo apt-key add -
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php5.list
Then
sudo apt-get update
sudo apt-get install -y php5.6
php -v
Output
PHP 5.6.33-1+0~20180105151408.9+stretch~1.gbp0deeda (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
For more
sudo apt-get install php5.6-cli php5.6-common php5.6-curl php5.6-mbstring php5.6-mysql php5.6-xml php5.6-ldap mysql-client
sudo service apache2 restart
Installing Cloud 9 IDE
sudo git clone https://github.com/c9/core.git c9sdk
cd c9sdk
sudo apt-get install build-essential
sudo scripts/install-sdk.sh
sudo apt-get install -y nodejs
In order to startup the server run:
sudo node server.js -w /var/www/html -p 8181 -l 0.0.0.0 --auth test:test
Crontab
Edit
sudo crontab -e
View
sudo crontab -l
Start/stop service
sudo service cron restart
tail -f /var/log/syslog
Examples
15 6 * * * /usr/bin/php /var/www/html/tag-server/test.php > /var/log/TI/`date +\%Y-\%m-\%d_\%H:\%M:\%S`_suf_ad_user-.log 2>&1
0 0 * * * sudo indexer --rotate --all --config /etc/sphinxsearch/sphinx.conf > /var/log/TI/`date +\%Y-\%m-\%d_\%H:\%M:\%S`_sphinx_indexer.log 2>&1
┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of the month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
│ │ │ │ │ 7 is also Sunday on some systems)
│ │ │ │ │
│ │ │ │ │
* * * * * command to execute
Installing Yarn
On Debian or Ubuntu Linux, you can install Yarn via our Debian package repository. You will first need to configure the repository:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
On Ubuntu 16.04 or below and Debian Stable, you will also need to configure the NodeSource repository to get a new enough version of Node.js.
Then you can simply:
sudo apt-get update && sudo apt-get install yarn
Note: Ubuntu 17.04 comes with cmdtest installed by default. If you’re getting errors from installing yarn, you may want to run sudo apt remove cmdtest first. Refer to this for more information.
If using nvm you can avoid the node installation by doing:
sudo apt-get install --no-install-recommends yarn
Note: Due to the use of nodejs instead of node name in some distros, yarn might complain about node not being installed. A workaround for this is to add an alias in your .bashrc file, like so: alias node=nodejs. This will point yarn to whatever version of node you decide to use.
Test that Yarn is installed by running:
yarn --version