Skip to content

Instantly share code, notes, and snippets.

@cloudnull
Last active October 29, 2024 14:27
Show Gist options
  • Save cloudnull/7244539b7481fe23a35d50f7d4b07573 to your computer and use it in GitHub Desktop.
Save cloudnull/7244539b7481fe23a35d50f7d4b07573 to your computer and use it in GitHub Desktop.

Revisions

  1. cloudnull revised this gist Oct 16, 2022. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions unifi-debian11-install.sh
    Original file line number Diff line number Diff line change
    @@ -27,10 +27,8 @@ if ! grep -q JAVA_HOME /etc/environment; then
    echo export JAVA_HOME=${JAVA_HOME} | tee -a /etc/environment
    fi

    update-alternatives --remove-all java
    pushd /usr/bin
    ln -s ${JAVA_HOME}/bin/java
    popd
    update-alternatives --remove-all java || true
    update-alternatives --install /usr/bin/java java ${JAVA_HOME}/bin/java 20

    # Install unifi
    sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
  2. cloudnull revised this gist Sep 6, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion unifi-debian11-install.sh
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ pushd /usr/lib/jvm
    popd

    if ! grep -q java /etc/profile; then
    echo export PATH=\${PATH}:$(echo $(find /usr/lib/jvm/ -type d -name bin | sed 's/:$/\n/') | tr ' ' ':') | tee -a /etc/profile
    echo "export PATH=\"$(find /usr/lib/jvm/ -type d -name bin | tr '\n' ':')\${PATH}\"" | tee -a /etc/profile
    fi

    JAVA_HOME=$(find /usr/lib/jvm/ -maxdepth 1 -type d | tail -n 1)
  3. cloudnull revised this gist Sep 6, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions unifi-debian11-install.sh
    Original file line number Diff line number Diff line change
    @@ -18,8 +18,8 @@ pushd /usr/lib/jvm
    tar -xf java.tgz
    popd

    if ! grep -q java /etc/environment; then
    echo export PATH=\${PATH}:$(find /usr/lib/jvm/ -type d -name bin | sed 's/:$/\n/') | tee -a /etc/profile
    if ! grep -q java /etc/profile; then
    echo export PATH=\${PATH}:$(echo $(find /usr/lib/jvm/ -type d -name bin | sed 's/:$/\n/') | tr ' ' ':') | tee -a /etc/profile
    fi

    JAVA_HOME=$(find /usr/lib/jvm/ -maxdepth 1 -type d | tail -n 1)
  4. cloudnull revised this gist Sep 6, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion unifi-debian11-install.sh
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ pushd /usr/lib/jvm
    popd

    if ! grep -q java /etc/environment; then
    echo export PATH=\${PATH}:$(find /usr/lib/jvm/ -type d -name bin | sed 's/:$/\n/') | tee -a /etc/environment
    echo export PATH=\${PATH}:$(find /usr/lib/jvm/ -type d -name bin | sed 's/:$/\n/') | tee -a /etc/profile
    fi

    JAVA_HOME=$(find /usr/lib/jvm/ -maxdepth 1 -type d | tail -n 1)
  5. cloudnull revised this gist Sep 5, 2022. No changes.
  6. cloudnull revised this gist Sep 4, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions unifi-debian11-install.sh
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,7 @@ if ! grep -q JAVA_HOME /etc/environment; then
    echo export JAVA_HOME=${JAVA_HOME} | tee -a /etc/environment
    fi

    update-alternatives --remove-all java
    pushd /usr/bin
    ln -s ${JAVA_HOME}/bin/java
    popd
  7. cloudnull revised this gist Sep 4, 2022. 2 changed files with 48 additions and 44 deletions.
    44 changes: 0 additions & 44 deletions unifi-debian10-install.sh
    Original file line number Diff line number Diff line change
    @@ -1,44 +0,0 @@
    #!/usr/bin/env bash

    # Install dependencies
    apt install apt-transport-https ca-certificates wget dirmngr gnupg gnupg2 software-properties-common multiarch-support

    # Install old mongo (requried).
    wget -qO - https://www.mongodb.org/static/pgp/server-3.4.asc | apt-key add -
    echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
    wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
    dpkg -i libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

    # Get compatible java and set it up
    wget 'https://javadl.oracle.com/webapps/download/AutoDL?BundleId=244058_89d678f2be164786b292527658ca1605' -O java.tgz

    mkdir -p /usr/lib/jvm
    pushd /usr/lib/jvm
    tar -xf /tmp/java.tgz
    popd

    if ! grep -q java /etc/environment; then
    echo export PATH=\${PATH}:$(find /usr/lib/jvm/ -type d -name bin | sed 's/:$/\n/') | tee -a /etc/environment
    fi

    JAVA_HOME=$(find /usr/lib/jvm/ -maxdepth 1 -type d | tail -n 1)
    if ! grep -q JAVA_HOME /etc/environment; then
    echo export JAVA_HOME=${JAVA_HOME} | tee -a /etc/environment
    fi

    pushd /usr/local/bin
    ln -s ${JAVA_HOME}/bin/java
    popd

    # Install unifi
    apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50
    echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | tee /etc/apt/sources.list.d/100-ubnt-unifi.list
    apt update && apt -y install unifi

    # Ensure that the unifi service knows where java 8 is.
    if ! grep -q JAVA_HOME /lib/systemd/system/unifi.service; then
    mkdir -p /etc/systemd/system/unifi.service.d/
    echo -e "[Service]\nEnvironment=JAVA_HOME=${JAVA_HOME}" | tee /etc/systemd/system/unifi.service.d/local.conf
    systemctl daemon-reload
    systemctl restart unifi.service
    fi
    48 changes: 48 additions & 0 deletions unifi-debian11-install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    #!/usr/bin/env bash

    set -ev
    set -o pipefail

    # Install dependencies
    apt update
    apt -y install apt-transport-https ca-certificates wget dirmngr gnupg gnupg2 software-properties-common

    # Install old mongo (requried).
    wget -qO - https://www.mongodb.org/static/pgp/server-3.6.asc | sudo apt-key add -
    echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/3.6 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

    # Get compatible java and set it up
    mkdir -p /usr/lib/jvm
    pushd /usr/lib/jvm
    wget 'https://javadl.oracle.com/webapps/download/AutoDL?BundleId=246799_424b9da4b48848379167015dcc250d8d' -O java.tgz
    tar -xf java.tgz
    popd

    if ! grep -q java /etc/environment; then
    echo export PATH=\${PATH}:$(find /usr/lib/jvm/ -type d -name bin | sed 's/:$/\n/') | tee -a /etc/environment
    fi

    JAVA_HOME=$(find /usr/lib/jvm/ -maxdepth 1 -type d | tail -n 1)
    if ! grep -q JAVA_HOME /etc/environment; then
    echo export JAVA_HOME=${JAVA_HOME} | tee -a /etc/environment
    fi

    pushd /usr/bin
    ln -s ${JAVA_HOME}/bin/java
    popd

    # Install unifi
    sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
    echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list

    # Ensure that the unifi service knows where java 8 is.
    if ! grep -q JAVA_HOME /lib/systemd/system/unifi.service; then
    mkdir -p /etc/systemd/system/unifi.service.d/
    echo -e "[Service]\nEnvironment=JAVA_HOME=${JAVA_HOME}" | sudo tee /etc/systemd/system/unifi.service.d/local.conf
    systemctl daemon-reload
    fi

    apt update
    apt -y install unifi

    systemctl restart unifi.service
  8. cloudnull revised this gist Jan 12, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion unifi-debian10-install.sh
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,8 @@ apt update && apt -y install unifi

    # Ensure that the unifi service knows where java 8 is.
    if ! grep -q JAVA_HOME /lib/systemd/system/unifi.service; then
    sed -i "/^\[Service\]$/a Environment=JAVA_HOME=${JAVA_HOME}" /lib/systemd/system/unifi.service
    mkdir -p /etc/systemd/system/unifi.service.d/
    echo -e "[Service]\nEnvironment=JAVA_HOME=${JAVA_HOME}" | tee /etc/systemd/system/unifi.service.d/local.conf
    systemctl daemon-reload
    systemctl restart unifi.service
    fi
  9. cloudnull created this gist Apr 10, 2021.
    43 changes: 43 additions & 0 deletions unifi-debian10-install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    #!/usr/bin/env bash

    # Install dependencies
    apt install apt-transport-https ca-certificates wget dirmngr gnupg gnupg2 software-properties-common multiarch-support

    # Install old mongo (requried).
    wget -qO - https://www.mongodb.org/static/pgp/server-3.4.asc | apt-key add -
    echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
    wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
    dpkg -i libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb

    # Get compatible java and set it up
    wget 'https://javadl.oracle.com/webapps/download/AutoDL?BundleId=244058_89d678f2be164786b292527658ca1605' -O java.tgz

    mkdir -p /usr/lib/jvm
    pushd /usr/lib/jvm
    tar -xf /tmp/java.tgz
    popd

    if ! grep -q java /etc/environment; then
    echo export PATH=\${PATH}:$(find /usr/lib/jvm/ -type d -name bin | sed 's/:$/\n/') | tee -a /etc/environment
    fi

    JAVA_HOME=$(find /usr/lib/jvm/ -maxdepth 1 -type d | tail -n 1)
    if ! grep -q JAVA_HOME /etc/environment; then
    echo export JAVA_HOME=${JAVA_HOME} | tee -a /etc/environment
    fi

    pushd /usr/local/bin
    ln -s ${JAVA_HOME}/bin/java
    popd

    # Install unifi
    apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50
    echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | tee /etc/apt/sources.list.d/100-ubnt-unifi.list
    apt update && apt -y install unifi

    # Ensure that the unifi service knows where java 8 is.
    if ! grep -q JAVA_HOME /lib/systemd/system/unifi.service; then
    sed -i "/^\[Service\]$/a Environment=JAVA_HOME=${JAVA_HOME}" /lib/systemd/system/unifi.service
    systemctl daemon-reload
    systemctl restart unifi.service
    fi