Алгоритм установки CLJ

Материал из vetsoft
Перейти к навигации Перейти к поиску

Содержание

Как ставить Clojure

Устанавливаем на виртуальную машину 22.04

  sudo apt-get update 
  sudo apt-get upgrade

Ставим файловый менеджер

  sudo apt-get install mc

Ставим Java

Проверяем установлена ли java

  java -version

Если да - то обновляем


Если нет то ставим


    sudo apt-get install -y software-properties-common wget apt-transport-https
    
    sudo mkdir -p /etc/apt/keyrings
    wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo tee /etc/apt/keyrings/adoptium.asc


    echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list


   sudo apt-get update
   sudo apt-get install -y temurin-17-jdk
   java -version


Ставим Leiningen

Ставим curl

  sudo apt-get install -y curl

Качаем скрипт Lein

  curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > lein

Перемещаем в директорию

  sudo mv lein /usr/local/bin/lein

Устанавливаем свойства запуска

  sudo chmod a+x /usr/local/bin/lein

Запускаем

  lein version


Clojure Command Line Interface (CLI)

Ставим зависимости

   sudo apt-get install -y bash curl rlwrap

Качаем скрипт установки

  curl -O https://download.clojure.org/install/linux-install-1.10.2.774.sh


Устанавливаем свойства запуска

  chmod +x linux-install-1.10.2.774.sh

Запускаем инсталятор

  sudo ./linux-install-1.10.2.774.sh

Проверяем версию

  clj


Свежее

   curl -O https://download.clojure.org/install/linux-install-1.11.1.1208.sh
   chmod +x linux-install-1.11.1.1208.sh
   sudo ./linux-install-1.11.1.1208.sh


Ставим редакторы

Ставим VS Code

    sudo apt install software-properties-common apt-transport-https wget
    wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
    sudo apt update
    sudo apt install code

Другие

    sudo add-apt-repository ppa:kelleyk/emacs 
    sudo apt-get update 
    sudo apt install emacs28
   Emacs
   Что почитать


   в удаленке
   читать 1
   читать 2

Ставим GraalVM

Ставим версию Java

  sudo apt install openjdk-17-jre-headless

Качаем свою версия под процессор

   Sudo wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.2/graalvm-ce-java17-linux-amd64-22.3.2.tar.gz

Распаковываем архив там где скачали

   tar –xvzf graalvm-ce-java17-linux-amd64-22.3.2.tar.gz

Создаем каталог

   sudo mkdir /usr/lib/jvm

Переносим

   sudo mv graalvm-ce-java17-22.3.2/ /usr/lib/jvm

Переходим в каталог

 cd  /usr/lib/jvm

Для упрощения жизни создаем симлинк

  sudo ln -s graalvm-ce-java17-22.3.2/ graalvm

Прописываем пути

   echo 'export PATH=/usr/lib/jvm/graalvm-ce-java17-22.3.2/bin:$PATH' >> ~/.bashrc
   echo 'export JAVA_HOME=/usr/lib/jvm/graalvm-ce-java17-22.3.2' >> ~/.bashrc
   source ~/.bashrc

Проверяем версию

  java -version
  openjdk version "17.0.7" 2023-04-18
  OpenJDK Runtime Environment GraalVM CE 22.3.2 (build 17.0.7+7-jvmci-22.3-b18)
  OpenJDK 64-Bit Server VM GraalVM CE 22.3.2 (build 17.0.7+7-jvmci-22.3-b18, mixed mode, sharing)


Ставим native-image

   sudo su
   /usr/lib/jvm/graalvm/bin/gu install native-image


   Проверяем установку
   
   native-image --version


Мурзилка https://github.com/swseighman/Installing-GraalVM-Enterprise-Edition

Установка RDP

  sudo apt install xrdp
 
  sudo systemctl enable xrdp

Установка nvm

   curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
   source ~/.profile

Ставим последнюю версию node

   nvm install node


Спецификация Ring

   https://github.com/ring-clojure/ring/blob/master/SPEC


VirtualBox

Делаем файл запуска в нем пишем своего пользователя и группу

   sudo systemctl edit vbox@.service --full --force
   [Unit]
   Description=Virtual Box Guest %I
   After=network.target vboxdrv.service
   Before=runlevel2.target shutdown.target
   [Service]
   User=root
   Group=root
   Type=forking
   Restart=no
   TimeoutSec=5min
   IgnoreSIGPIPE=no
   KillMode=process
   GuessMainPID=no
   RemainAfterExit=yes
   ExecStart=/usr/bin/VBoxManage startvm %i --type headless
   ExecStop=/usr/bin/VBoxManage controlvm %i acpipowerbutton
   [Install]
   WantedBy=multi-user.target

Перегружаем сервисы

  sudo systemctl daemon-reload


Смотрим список виртуальных машин

   VBoxManage list vms

Теперь запускаем и активируем нужные

   avnew@ubhost:~$ VBoxManage list vms
   "ubServer" {ebafeea1-8a2d-4dd2-aacc-f7b70f70488a}
   "ubServerR" {d9bd7c77-1f63-4dfc-83cd-885e6303f6fd}
   avnew@ubhost:~$ 


   sudo systemctl start vbox@d9bd7c77-1f63-4dfc-83cd-885e6303f6fd
   sudo systemctl enable vbox@d9bd7c77-1f63-4dfc-83cd-885e6303f6fd

Перегружаемся.


Guacamole

1

   sudo apt install -y gcc vim curl wget g++ libcairo2-dev libjpeg-turbo8-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev  libavformat-dev libavutil-dev libswscale-dev build-essential libpango1.0-dev libssh2-1-dev libvncserver-dev libtelnet-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev libwebsockets-dev


Install FreeRDP2

   sudo add-apt-repository ppa:remmina-ppa-team/remmina-next-daily
   sudo apt update
   sudo apt install freerdp2-dev freerdp2-x11 -y


Install Apache Tomcat

   sudo apt install openjdk-11-jdk


проверяем версию java

    java --version


Create Tomcat system user


    sudo useradd -m -U -d /opt/tomcat -s /bin/false tomcat


Fetch Apache Tomcat

    cd ~/
    wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.8/bin/apache-tomcat-10.1.8.tar.gz


    sudo mkdir /opt/tomcat
    sudo tar -xzf apache-tomcat-*.tar.gz -C /opt/tomcat/
    sudo mv /opt/tomcat/apache-tomcat-*/ /opt/tomcat/tomcatapp
    sudo chown -R tomcat: /opt/tomcat
    sudo find /opt/tomcat/tomcatapp/bin/ -type f -iname "*.sh" -exec chmod +x {} \;


    sudo nano /etc/systemd/system/tomcat.service


    [Unit]
    Description=Tomcat 9 servlet container
    After=network.target
    [Service]
    Type=forking
    User=tomcat
    Group=tomcat
    Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
    Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true"
    Environment="CATALINA_BASE=/opt/tomcat/tomcatapp"
    Environment="CATALINA_HOME=/opt/tomcat/tomcatapp"
    Environment="CATALINA_PID=/opt/tomcat/tomcatapp/temp/tomcat.pid"
    Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
    ExecStart=/opt/tomcat/tomcatapp/bin/startup.sh
    ExecStop=/opt/tomcat/tomcatapp/bin/shutdown.sh
    [Install]
    WantedBy=multi-user.target


    sudo systemctl daemon-reload
    sudo systemctl enable --now tomcat
    systemctl status tomcat


    sudo ufw allow 8080/tcp


Build the Guacamole Server From Source

Грузим стабильную версию


    cd ~/
    wget https://archive.apache.org/dist/guacamole/1.5.0/source/guacamole-server-1.5.0.tar.gz


    tar xzf ~/guacamole-server-*.tar.gz
    cd ~/guacamole-server-*/
    ./configure --with-init-dir=/etc/init.d
    make
    sudo make install
    sudo ldconfig
    sudo mkdir /etc/guacamole


    sudo nano /etc/guacamole/guacd.conf
    
    [daemon]
    pid_file = /var/run/guacd.pid
    #log_level = debug
     
    [server]
    #bind_host = localhost
    bind_host = 127.0.0.1
    bind_port = 4822
    
    #[ssl]
    #server_certificate = /etc/ssl/certs/guacd.crt
    #server_key = /etc/ssl/private/guacd.key


    sudo systemctl daemon-reload
    sudo systemctl start guacd
    sudo systemctl enable guacd


Install the Guacamole Web Application

There are two critical files involved in the deployment of Guacamole: guacamole.war, which is the file containing the web application, and guacamole.properties, the main configuration file for Guacamole. The recommend way to set up Guacamole involves placing these files in standard locations, and then creating symbolic links to them so that Tomcat can find them.

guacamole-client contains all Java and Maven components of Guacamole (guacamole, guacamole-common, guacamole-ext, and guacamole-common-js). These components ultimately make up the web application that will serve the HTML5 Guacamole client to users that connect to your server. This web application will connect to guacd, part of guacamole-server, on behalf of connected users in order to serve them any remote desktop they are authorized to access.


  wget https://archive.apache.org/dist/guacamole/1.5.0/binary/guacamole-1.5.0.war
  sudo mkdir /etc/guacamole
  sudo mv guacamole-1.5.0.war /etc/guacamole/guacamole.war
  sudo ln -s /etc/guacamole/guacamole.war /opt/tomcat/tomcatapp/webapps


Configure Guacamole Server

   echo "GUACAMOLE_HOME=/etc/guacamole" | sudo tee -a /etc/default/tomcat
   echo "export GUACAMOLE_HOME=/etc/guacamole" | sudo tee -a /etc/profile


   sudo nano /etc/guacamole/guacamole.properties
    guacd-hostname: localhost
    guacd-port:    4822
    user-mapping:    /etc/guacamole/user-mapping.xml
    auth-provider:    net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider


   sudo ln -s /etc/guacamole /opt/tomcat/tomcatapp/.guacamole
   sudo chown -R tomcat: /opt/tomcat


Setup Guacamole Authentication Method

   echo -n GoodStrongPassword | openssl md5
   (stdin)= 2df81f5bfb14c621dbfd98e0d08c2f35


   echo -n AdminStrongPassword | openssl md5
   (stdin)= 53bdac1400db24248d8b6cf9fcf93dc6


   sudo nano /etc/guacamole/user-mapping.xml
   <user-mapping>
   <authorize 
           username="GeeksAdmin"
           password="2df81f5bfb14c621dbfd98e0d08c2f35"
           encoding="md5">
       <connection name="RHEL 7 Maipo">
           <protocol>ssh</protocol>
           <param name="hostname">172.25.169.26</param>
           <param name="port">22</param>
       </connection>
       <connection name="Windows Server 2019">
           <protocol>rdp</protocol>
           <param name="hostname">10.10.10.5</param>
           <param name="port">3389</param>
           <param name="username">tech</param>
           <param name="ignore-cert">true</param>
       </connection>
   </authorize>
   <authorize 
           username="TechAdmin"
           password="53bdac1400db24248d8b6cf9fcf93dc6"  
           encoding="md5">
       <connection name="Windows Server 2019">
           <protocol>rdp</protocol>
           <param name="hostname">10.10.10.5</param>
           <param name="port">3389</param>
           <param name="username">tech</param>
           <param name="ignore-cert">true</param>
       </connection>
       <connection name="RHEL 7 Maipo">
           <protocol>ssh</protocol>
           <param name="hostname">172.25.169.26</param>
           <param name="port">22</param>
       </connection>
   </authorize>
   </user-mapping>


   sudo systemctl restart tomcat guacd


Getting Guacamole Web Interface

   http://ip-or-domain-name:8080/guacamole

Как установить часовой пояс

Смотрим какой стоит

   timedatectl


   timedatectl list-timezones | grep -i europe


   sudo timedatectl set-timezone Europe/Moscow


   sudo apt install ntpdate


   @echo off
   query session /server:127.0.0.1
   set /P rid="Enter RDP user ID: "
   start mstsc /shadow:%rid% /v:127.0.0.1 /control /noConsentPrompt