Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 28 additions & 9 deletions docs/quick_start_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ This guide will help you quickly set up a Lightway VPN server and client using t

### Server Requirements

- Linux system (x86_64, arm64, or riscv64)
- Root or sudo access
- The following packages:
- `jq`, `yq` (for parsing server and client config.yaml files)
- `apache2-utils` (htpasswd for user authentication)
- `iproute2`
- `iptables`

Install dependencies on Debian/Ubuntu:
- Nix user
- use quick start shell
- `nix develop github:expressvpn/lightway#quick-start`
- None Nix user
- Linux system (x86_64, arm64, or riscv64)
- Root or sudo access
- The following packages:
- `jq`, `yq` (for parsing server and client config.yaml files)
- `apache2-utils` (htpasswd for user authentication)
- `iproute2`
- `iptables`
- Install dependencies on Debian/Ubuntu:
```bash
sudo apt-get update
sudo apt-get install jq yq apache2-utils iproutes2 iptables
Expand All @@ -45,7 +48,11 @@ chmod +x lightway-server
```

### 2. Download the Setup Script
- Nix user
- The script is also included in the quick-start shell, you do not need to download it.

- None Nix user
- Download latest script from repository
```bash
curl -L -o server_start.sh https://raw.githubusercontent.com/expressvpn/lightway/main/samples/server_start.sh
chmod +x server_start.sh
Expand Down Expand Up @@ -104,6 +111,12 @@ Edit the config to update the database (`user_db`) and certificate paths (`serve

Use the provided setup script to start the server:

- Nix user
```bash
sudo server_start server_config.yaml
```

- None Nix user
```bash
sudo ./server_start.sh server_config.yaml
```
Expand Down Expand Up @@ -151,6 +164,12 @@ Edit the config to update `server`, `ca_cert`, `user`, and `password` fields.

Run the client to establish a VPN connection to the server:

- Nix user
```bash
sudo nix run github:expressvpn/lightway#lightway-client -- --config-file client_config.yaml
```

- None Nix user
```bash
sudo ./lightway-client --config-file client_config.yaml
```
20 changes: 19 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@
};
clientFeatures = [ ] ++ lib.optional pkgs.stdenv.isLinux [ "io-uring" ];
serverFeatures = [ ] ++ lib.optional pkgs.stdenv.isLinux [ "io-uring" ];
serverStartScript = pkgs.writeShellScriptBin "server_start" (builtins.readFile ./samples/server_start.sh);
in
{
rec {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.rust-overlay.overlays.default ];
Expand All @@ -98,6 +99,23 @@
devShells.stable = mkDevShell pkgs.rust-bin.stable.latest.default;
devShells.nightly = mkDevShell pkgs.rust-bin.nightly.latest.default;
devShells.msrv = mkDevShell pkgs.rust-bin.stable.${msrv}.default;
devShells.quick-start = pkgs.mkShell {
shellHook = ''
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
'';
buildInputs = runtimeDeps;
nativeBuildInputs = buildDeps ++ devDeps ++ (with pkgs; [
apacheHttpd
iproute2
iptables
jq
openssl
yq
]) ++ [
packages.lightway-server
serverStartScript
];
};

formatter = pkgs.nixfmt-rfc-style;
};
Expand Down
6 changes: 3 additions & 3 deletions samples/server_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ check_dependencies() {
exit 1
fi

if [[ ! -f "./lightway-server" ]]; then
if [[ ! -f "./lightway-server" ]] && [[ ! -x "$(command -v lightway-server)" ]]; then
echo "Error: lightway-server binary not found in current directory" >&2
exit 1
fi
Expand Down Expand Up @@ -117,5 +117,5 @@ iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -s "${tun_ip_subnet}" -o "${wandev}" -j SNAT --to "${basenet}"

./lightway-server -c "${VPN_SERVER_CONFIG}" "${EXTRA_ARGS[@]}"

./lightway-server -c "${VPN_SERVER_CONFIG}" "${EXTRA_ARGS[@]}" ||
lightway-server -c "${VPN_SERVER_CONFIG}" "${EXTRA_ARGS[@]}"