Skip to content

Instantly share code, notes, and snippets.

@lokeshsoni
Last active November 28, 2020 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lokeshsoni/d913ac5f660ee93e77f66ad5e607c414 to your computer and use it in GitHub Desktop.
Save lokeshsoni/d913ac5f660ee93e77f66ad5e607c414 to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo yum update -y
sudo yum install -y git bzip2 vim htop tree zip unzip
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p ${HOME}/miniconda
rm miniconda.sh
export PATH=${HOME}/miniconda/bin:${PATH}
cat <<EOF >> ~/.bashrc
# added by the script
export PATH=$HOME/miniconda/bin:\$PATH
EOF
conda update --yes conda
pip install -U pip jupyterlab
ENV_HOME=$HOME/miniconda/envs
jupyter notebook --generate-config
# set password
# jupyter notebook password
# or use a preset password
jupass='argon2:$argon2id$v=19$m=10240,t=10,p=8$JEZVVXKn296CdMpTbGa/Jg$7VNdt3Cuw4dtC25cYMHj/A'
cat <<EOF >> $HOME/.jupyter/jupyter_notebook_config.py
# added by script
c.NotebookApp.password = u'$jupass'
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8989
EOF
cat <<EOF > jupyter.service
[Unit]
Description=Jupyter Lab
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=$HOME/miniconda/bin/jupyter-lab --config=$HOME/.jupyter/jupyter_notebook_config.py
User=$USER
Group=$USER
WorkingDirectory=$HOME
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
sudo mv jupyter.service /etc/systemd/system/jupyter.service
sudo systemctl enable jupyter.service
sudo systemctl daemon-reload
sudo systemctl restart jupyter.service
#!/bin/bash
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
sudo apt install -y git bzip2 vim htop tree zip unzip
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p ${HOME}/miniconda
rm miniconda.sh
export PATH=${HOME}/miniconda/bin:${PATH}
cat <<EOF >> ~/.bashrc
# added by the script
export PATH=$HOME/miniconda/bin:\$PATH
EOF
conda update --yes conda
pip install -U pip jupyterlab
ENV_HOME=$HOME/miniconda/envs
jupyter notebook --generate-config
# set password
jupyter notebook password
# or use a preset password : dev123
jupass=sha1:d02bbaa62cbd:b72fe9ee69fbec245862a6962aae148546881946
cat <<EOF >> $HOME/.jupyter/jupyter_notebook_config.py
# added by script
c.NotebookApp.password = u'$jupass'
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
EOF
cat <<EOF > jupyter.service
[Unit]
Description=Jupyter Lab
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=$HOME/miniconda/bin/jupyter-lab --config=$HOME/.jupyter/jupyter_notebook_config.py
User=$USER
Group=$USER
WorkingDirectory=$HOME
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
sudo mv jupyter.service /etc/systemd/system/jupyter.service
sudo systemctl enable jupyter.service
sudo systemctl daemon-reload
sudo systemctl restart jupyter.service
# create tf kernel
conda create -y -n tf python=3
conda activate tf
pip install tensorflow-gpu ipykernel
python -m ipykernel install --user --name tf
# install gpu drivers
## Add NVIDIA package repositories
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
rm cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt update
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
rm nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt update
## Install NVIDIA driver
sudo apt install --no-install-recommends nvidia-driver-418
## Check that GPUs are visible using the command
nvidia-smi
# Install development and runtime libraries (~4GB)
sudo apt install --no-install-recommends \
cuda-10-0 \
libcudnn7=7.6.2.24-1+cuda10.0 \
libcudnn7-dev=7.6.2.24-1+cuda10.0
# Install TensorRT
sudo apt install -y --no-install-recommends libnvinfer5=5.1.5-1+cuda10.0 libnvinfer-dev=5.1.5-1+cuda10.0
#!/bin/bash
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
sudo apt install -y git bzip2 vim htop tree zip unzip
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p ${HOME}/miniconda
rm miniconda.sh
export PATH=${HOME}/miniconda/bin:${PATH}
cat <<EOF >> ~/.bashrc
# added by the script
export PATH=$HOME/miniconda/bin:\$PATH
EOF
conda update --yes conda
pip install -U pip jupyterlab
ENV_HOME=$HOME/miniconda/envs
jupyter notebook --generate-config
# set password
# jupyter notebook password
# or use a preset password
jupass='argon2:$argon2id$v=19$m=10240,t=10,p=8$JEZVVXKn296CdMpTbGa/Jg$7VNdt3Cuw4dtC25cYMHj/A'
cat <<EOF >> $HOME/.jupyter/jupyter_notebook_config.py
# added by script
c.NotebookApp.password = u'$jupass'
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8989
EOF
cat <<EOF > jupyter.service
[Unit]
Description=Jupyter Lab
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=$HOME/miniconda/bin/jupyter-lab --config=$HOME/.jupyter/jupyter_notebook_config.py
User=$USER
Group=$USER
WorkingDirectory=$HOME
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
sudo mv jupyter.service /etc/systemd/system/jupyter.service
sudo systemctl enable jupyter.service
sudo systemctl daemon-reload
sudo systemctl restart jupyter.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment