S
S
Solidity
Search…
ubuntu Useful Commands

Update Ubuntu version

1
// Check Ubuntu Version
2
$: lsb_release -a
3
4
// Update your Current Ubuntu server to the latest:
5
6
// Step 1: This command refreshes your local list of software,
7
// making a note of any newer revisions and updates. If there’s a newer version
8
// of the kernel, the command will find it and mark it for download and
9
//installation.
10
$: sudo apt-get update
11
12
// Step 2: The “dist-upgrade” switch asks Ubuntu to handle any dependencies
13
// intelligently. That is, if a particular software package is dependent on
14
// another software package to run, this command will make sure that the second
15
// package is upgraded before upgrading the first one. This method is a safe way
16
// to upgrade your Ubuntu Linux kernel. The kernel updates accessible through
17
// this utility have been tested and verified to work with your version of Ubuntu.
18
$: sudo apt-get dist-upgrade
Copied!

Install Node.js

1
// Install Node.js on Ubuntu
2
// One very convenient way to install Node.js is through a package manager of ubuntu
3
// Official Procedure: https://github.com/nodesource/distributions/blob/master/README.md
4
// Which version to select: https://nodejs.org/en/
5
6
// Step 1: check the current by default ubuntu node version
7
$: node -v
8
$: nodejs -v
9
10
// Step 2: Install Node.js 14.X LTS and npm
11
$: curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
12
$: sudo apt-get install -y nodejs
13
## You may also need development tools to build native addons:
14
sudo apt-get install gcc g++ make
15
16
// Step 3: Install the Yarn package manager, run:
17
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
18
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
19
sudo apt-get update && sudo apt-get install yarn
20
21
// Yarn is a JavaScript package manager compatible with npm that helps
22
// you automate the process of installing, updating, configuring,
23
// and removing npm packages. It caches every download package and
24
// speeds up the installation process by parallelizing operations.
25
Copied!

Install node.js package - Lite Web Server

1
// Install NPM lite Server package on the directory of the project
2
$ cd /ProjectDirectory
3
// Install the NPM lite-server
4
$ npm install lite-server
5
6
// Create in the project root directory a file package.json
7
// This is the config file used by NPM and add the following inside of it:
8
# Inside package.json...
9
"scripts": {
10
"dev": "lite-server"
11
}
12
13
// Then you can launch the lite-Server npm package
14
$ npm run dev
15
16
// if you run it on a server, launch it as a dedicated process:
17
$: nohup npm run dev >> runningwebserver.log 2>&1 &
18
// in runningwebserver.log -> you will have all the npm lite web server output
19
20
// You have a Local Web Server running on http://localhost:3000
21
22
// Copy on the root section of your project an index.html file
23
//Add "Hello World" inside of it
24
/Then refresh the browser page you should see your first web page
25
26
// To Stop the running lite-server, do in the CLI running windows and enter
27
// ctrl + C
28
29
// To specify a src base directory for your project, create a bs-config.json
30
// in your project's folder with the following content:
31
32
{
33
"port": 8000,
34
"files": ["./src/**/*.{html,htm,css,js}"],
35
"server": { "baseDir": "./src" }
36
}
37
38
// Then in the project directory create a folder:
39
$ mkdir src
40
$ cd src
41
// create an index.html file that will be the host page of the Demon
42
43
// Open the Chrome Browser and go to view/developer/Javascrip console for debugging
Copied!

Git

1
// Copy your project git repo on your server
2
// To to the project directory on Ubuntu and copy your git project there:
3
$: git clone https://github.com/IPConvergence/TrustedDistributedOpenDataRegistry
Copied!

Ubuntu CLI System useful commands

1
// If you have a big project to copy from server to your PC
2
// Create a zip of all the project folder and its content
3
// On Linux, gzip is unable to compress a folder, it used to compress
4
// a single file only. To compress a folder, you should use tar + gzip,
5
which is tar -z.
6
7
$: tar -zcvf outputFileName folderToCompress
8
9
// To uncompress on your local PC:
10
$: tar -xzvf compressfile.
Copied!