diff --git a/ubuntu/new_data_server/install_jupyterlab.sh b/ubuntu/new_data_server/install_jupyterlab.sh new file mode 100644 index 0000000..7076084 --- /dev/null +++ b/ubuntu/new_data_server/install_jupyterlab.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# Function to check if a command is available +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +# Check if the script is running with root privileges +if [ "$EUID" -ne 0 ]; then + echo "This script must be run with root privileges." + exit 1 +fi + +# Check if Python is installed +if ! command_exists python3; then + echo "Python3 is not installed. Please install Python3 first." + exit 1 +fi + +# Update system packages +apt update + +# Install required packages +apt install -y python3-pip + +# Upgrade pip +pip3 install --upgrade pip + +# Install JupyterLab +pip3 install jupyterlab + +# Create a JupyterLab configuration directory +mkdir -p /etc/jupyterlab + +# Generate JupyterLab configuration file +jupyter lab --generate-config -y + +# Modify JupyterLab configuration to listen on all available interfaces +echo "c.ServerApp.ip = '0.0.0.0'" >> /etc/jupyterlab/jupyter_lab_config.py + +# Create a systemd service file +cat < /etc/systemd/system/jupyterlab.service +[Unit] +Description=JupyterLab + +[Service] +Type=simple +PIDFile=/run/jupyterlab.pid +ExecStart=/usr/local/bin/jupyter lab --config=/etc/jupyterlab/jupyter_lab_config.py +User=YOUR_USERNAME # Replace this with your username +WorkingDirectory=/path/to/jupyterlab # Replace this with the directory you want to run JupyterLab from + +[Install] +WantedBy=multi-user.target +EOF + +# Replace "YOUR_USERNAME" and "/path/to/jupyterlab" with your desired values. +# Make sure to specify the correct path to the JupyterLab installation directory. + +# Enable and start the JupyterLab service +systemctl enable jupyterlab +systemctl start jupyterlab + +echo "JupyterLab has been installed and set up as a systemd service." +echo "You can access it from other computers on the network by opening your browser and navigating to http://YOUR_SERVER_IP_OR_DOMAIN:8888" + diff --git a/ubuntu/new_server.md b/ubuntu/new_data_server/new_server.md similarity index 100% rename from ubuntu/new_server.md rename to ubuntu/new_data_server/new_server.md