@ -8,22 +8,22 @@ You will need the package `build-essential` to be installed. We need this specif
As the `root` user run these commands:
~~~bash
```bash
apt update
apt install -y build-essential
~~~
```
If you do not have root access and just want to check the dependency is installed you can use this command:
~~~bash
```bash
dpkg -s build-essential | grep Status:
~~~
```
If the program is installed you will see this result:
~~~bash
```bash
Status: install ok installed
~~~
```
### Create a local user account
@ -35,9 +35,9 @@ If you need to create a local user account you can run this command:
**Important note:** replace `username` with a user name of your choosing and create a password when prompted
~~~bash
```bash
adduser --gecos "" username
~~~
```
Switch to your local user now and open an `ssh` session to continue with this guide.
@ -45,30 +45,30 @@ Switch to your local user now and open an `ssh` session to continue with this gu
To install and manage `node` as a local user we are going to use [Node Version Manager](https://github.com/nvm-sh/nvm) as an established solution to installing and managing multiple versions of node without needing `root` access. We are going to install the `lts` or long term support release of `node` to use with this application.
You can now call `node` to check it works using this command.
~~~bash
```bash
node -v
~~~
```
Your result should look something like this.
~~~bash
```bash
v12.16.2
~~~
```
**Note:** There is consideration with this method. `node` is only in the local user's path through sourcing of the `~/.nvm/nvm.sh` via the users `.bashrc` file. Unless this is done `node` will not be usable unless directly linked to and `nvm` commands will be unavailable.
The way we over come this issue for the needs of this guide is by using this command where applicable:
~~~bash
```bash
source ~/.nvm/nvm.sh && nvm which 12
~~~
```
**Why?** This command will always provide us with the path to the most current version of `node 12` installed via `nvm` regardless of other versions of `node` installed.
@ -78,25 +78,25 @@ source ~/.nvm/nvm.sh && nvm which 12
Make the required directory using this command:
~~~bash
```bash
mkdir -p ~/.ssl
~~~
```
Generate the self signed `openssl` certificates we will use to encrypt our web traffic when using `wetty` using this command:
**Note:** we are using`ecdsa` using the `secp521r1` curve.
**Important Note:** You must add the public key to your `authorized_keys` file in order to be able to log in using your `ssh` key file when accessing `wetty` via a web browser.
Copy the key to our `~/.ssh/authorized_keys` file, using this command:
~~~bash
```bash
cat ~/.ssh/wetty.pub >> ~/.ssh/authorized_keys
~~~
```
Now give these file and folders the correct permissions, using these commands:
~~~bash
```bash
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
chmod 600 ~/.ssh/wetty
~~~
```
**Optional:** A housekeeping command. If you need to remove all entries of the `wetty` public key with the comment `wetty-keyfile` from the `~/.ssh/authorized_keys` file use this command. Otherwise ignore this.
~~~bash
```bash
sed -r '/^ssh-ed25519(.*)wetty-keyfile$/d' -i ~/.ssh/authorized_keys
~~~
```
### Install wetty
@ -146,30 +146,30 @@ As your local user run these commands to install `wetty` and `forever`. We will
First, we need to make sure the local user's `~/bin` folder exists and is in the `PATH` for the following commands to work.
~~~bash
```bash
mkdir -p ~/bin && source ~/.profile
~~~
```
Please use either the `npm` or `yarn` method and not both. The `yarn` method is recommended but I provide both as you may have a personal preference. The outcome is effectively the same.
`npm `- optional - use `npm` to install wetty
`npm ` - optional - use `npm` to install wetty
~~~bash
```bash
npm install -g wetty forever --prefix ~/
~~~
```
`yarn` - recommended - use `yarn` to install wetty
~~~bash
```bash
npm install -g yarn --prefix ~/
yarn global add wetty forever --prefix ~/
~~~
```
Once successfully installed the application should be available in your local user's `PATH`. To test the installation was successful please use this command:
~~~bash
```bash
wetty -h
~~~
```
### Accessing the web interface.
@ -177,9 +177,9 @@ This needs to be done here because it is not easy to do in the next steps if `we
This command will generate the correct URL you need to visit after using the start up commands in the following section.
~~~bash
```bash
echo https://$(curl -s4 icanhazip.com):3000
~~~
```
*Please make make a note of this URL now.*
@ -191,23 +191,23 @@ For example, the below command would provide a `https` instance with automatic `
**Important note:** This command will run in your current terminal session and not in the background.
To stop `wetty` from running you can use this command:
~~~bash
```bash
forever stop ~/bin/wetty
~~~
```
#### Environment settings explained
Let's break it down so that we can understand what's being done and why.
~~~bash
```bash
--host 0.0.0.0 -p 3000 --title wetty --base /
~~~
```
`--host 0.0.0.0` - defines the interface we want to bind to. Using `0.0.0.0` means that we bind to all available interfaces so using this setting just works. When we use nginx we can change this to `--host 127.0.0.1` in order to prevent generic port access to the application and force traffic through our nginx reverse proxy URL.
@ -273,9 +273,9 @@ Let's break it down so that we can understand what's being done and why.
These settings are all specific to `ssh` and will enable you to automatically log into you ssh session for the selected user.