Latest Posts

Install n.eko (A Self Hosted Virtual Browser Docker) in Low Memory VPS (1GB)

Github project n.eko is a virtual browser based on the docker isolation environment, supports two types of browsers, Chrome and Firefox, and has built-in chat/simple user management functions. The UI design is very beautiful.




Project address: https://github.com/nurdism/neko

The program requires a relatively high configuration, see here for details:https://n.eko.moe/#/quick-start

Here are recommended specs:

ResolutionCoresRamRecommendation
1024×576@3022gbNot Recommended
1280x720@3043gbGood Performance
1280x720@3064gbRecommended
1280x720@3084gb+Best Performance

To run it in a low resource VPS, such as only 1GB RAM, 1vCPU, we will have to change SWAP size to make it more stable. 


Firewall Ports Open

Please make sure following two firewall rules created on your cloud VPS's firewall.
1. tcp 8080
2. udp 59000-59100



Change SWAP Size

Command (not support OpenVZ) from root user:
wget https://raw.githubusercontent.com/51sec/swap/main/swap.sh && bash swap.sh
When choose add swap, please enter number for size. Default metric is MB。

In screenshot, the priority is showing 0. Script in github has set to 100. 


Install Docker and Docker-Compose

Install docker:
apt -y update
apt -y install curl
curl -sSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker

Install docker-compose:

curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
You also can create a symbolic link to /usr/bin folder:
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Create docker-compose.yml and bring n.eko docker up


Create a new docker-compose project directory and edit docker-compose.yml.

cd ~
mkdir neko
cd neko
vi docker-compose.yml
Put following code into docker-compose.yml file based on the browser type.

Chrome Image:

version: '3.5'
services:
  neko:
    image: nurdism/neko:chromium
    restart: always
    cap_add:
      - SYS_ADMIN
    ports:
      - "8080:8080"
      - "59000-59100:59000-59100/udp"
    environment:
      DISPLAY: :99.0
      SCREEN_WIDTH: 1024
      SCREEN_HEIGHT: 576
      SCREEN_DEPTH: 24
      NEKO_PASSWORD: neko
      NEKO_ADMIN: admin
      NEKO_BIND: :8080

Firefox Image:

version: '3.5'
services:
  neko:
    image: nurdism/neko:firefox
    restart: always
    shm_size: "1gb"
    ports:
      - "8080:8080"
      - "59000-59100:59000-59100/udp"
    environment:
      DISPLAY: :99.0
      SCREEN_WIDTH: 1024
      SCREEN_HEIGHT: 576
      SCREEN_DEPTH: 24
      NEKO_PASSWORD: neko
      NEKO_ADMIN: admin
      NEKO_BIND: :8080


Notes:

SCREEN_DEPTH can be changed to 16 to save some resource usage on your host VPS. 

SCREEN_WIDTH=1280       // Display width
SCREEN_HEIGHT=720       // Display height
SCREEN_DEPTH=24         // Display bit depth
DISPLAY=:99.0           // Display number

NEKO_PASSWORD=neko      // Password
NEKO_ADMIN=neko         // Admin Password
NEKO_BIND=0.0.0.0:8080  // Bind
NEKO_KEY=               // (SSL)Key, needed for clipboard sync
NEKO_CERT=              // (SSL)Cert, needed for clipboard sync
docker-compose up -d
Now you should be able to browser to your n.eko's web interface with this url : http://<public ip>:8080

Fix Chinese Font Issue


Enter into docker:

docker exec -it root_neko_1 bash

Install fonts in docker:

apt -y update
apt -y install ttf-wqy-zenhei

exit and restart docker using docker-compose:

exit
docker-compose restart
If you have your own domain, you can using following steps to create https://<Sub Domain> this kind of access to n.eko project with Nginx's reverse proxy.
  • DNS sub domain created in your DNS provider, such as this sub domain, neko.51sec.org
  • Create your neko.51sec.org Nginx configuration. You can copy other Nginx web app's configuration then modify it.
  • run certbot --nginx to get LetsEncrypt certificate and modify neko.conf file to use those certificates.
  • test https://<Sub Domain>

YouTube Video:


References







No comments