#upgrade nodejs on ubuntu
Explore tagged Tumblr posts
programming-fields · 1 year ago
Text
0 notes
awesomecodetutorials · 5 years ago
Photo
Tumblr media
How to Install and Upgrade Node.js v12.x, v13.x on Ubuntu 18.04 LTS ☞ http://bit.ly/35747jZ #nodejs #javascript
1 note · View note
nodejs-fan · 6 years ago
Photo
Tumblr media
How to Install and Upgrade Node.js v12.x, v13.x on Ubuntu 18.04 LTS ☞ http://bit.ly/2qeHjj5 #nodejs #javascript
1 note · View note
zockainternet · 2 years ago
Text
Nesse passo a passo estarei mostrando um exemplo de como integrar um chat bot GPT-3 que é uma API da OPENAI, que criou o ChatGPT.   Integrando Chat GPT com WhatsApp Para fazer esse procedimento estou usando um servidor com Debian (mas já testei o funcionamento com ubuntu 18...). A integração está sendo feita com: node.js venom-bot api da openai OBS IMPORTANTE: Nos testes que realizei, criei um servidor apenas para essa finalidade, se você não tiver conhecimento técnico suficiente para entender o que está sendo feito, sugiro que instale em uma maquina virtual. Neste exemplo, estou utilizando usuário "root" para fazer todo procedimento.   Instalando o node.js e atualizando o servidor Vamos começar atualizando o sistema e instalando node.js no servidor: sudo apt-get update -y && apt-get upgrade -y curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - sudo apt-get update sudo apt install nodejs -y Depois disso, vamos instalar as dependências no servidor: sudo apt-get update sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev Após a instalações dessas bibliotecas, considere reiniciar o servidor. Prosseguindo, agora vamos instalar o venom-bot que será responsavel por conectar o chatbot ao WhatsApp: cd /root mkdir chatbot-whatsapp cd chatbot-whatsapp touch index.js npm i venom-bot No arquivo index, você vai colocar esse código: const venom = require('venom-bot'); venom .create() .then((client) => start(client)); function start(client) client.onMessage((message) => if (message.body === 'Olá' ); Agora teste o funcionamento e veja se o chatbot está funcionando digitando esse comando abaixo no terminal do servidor: node index.js Se estiver tudo certo, será exibido um QRCode para você autorizar o navegador dessa aplicação a usar o seu WhatsApp [caption id="attachment_1011" align="alignnone" width="300"] Exemplo de QRCode do chatbot[/caption] Depois disso, poderá testar digitando um "Olá" ou "Oi" para o WhatsApp conectado ao chatbot. E ele deverá responder pra você "Estou pronto!" [caption id="attachment_1012" align="alignnone" width="300"] Exemplo de resposta do chatbot[/caption] Se até essa etapa está tudo ok, podemos prosseguir.   Instalando a API do OPenAI e integrando com WhatsApp Agora vamos para integração com a api do openai, vamos fazer a integração do gpt-3 com o WhatsApp Para isso, vamos instalar a api do openai: cd /root/chatbot-whatsapp npm i openai Deverá criar um arquivo chamado ".env" com suas credenciais de acesso do openai (organização e api de acesso). OBS IMPORTANTE: é necessário se cadastrar no site da openai.com Depois disso poderá adquirir as informações nos seguintes links: OPENAI_API_KEY=https://platform.openai.com/account/api-keys ORGANIZATION_ID=https://platform.openai.com/account/org-settings Já o "PHONE_NUMBER=" é o numero do WhatsApp que você vai colocar no qrcode. touch .env echo "OPENAI_API_KEY=COLEAQUISUAAPI" >> /root/chatbot-whatsapp/.env echo "ORGANIZATION_ID=COLEAQUISUAORGANIZACAO" >> /root/chatbot-whatsapp/.env echo "[email protected]" >> /root/chatbot-whatsapp/.env Agora você pode substituir o código do arquivo index, ou criar um novo arquivo para testar, neste exemplo estou criando um novo arquivo: touch gpt.js E deverá colocar o seguinte código nele: const venom = require('venom-bot'); const dotenv = require('dotenv'); const Configuration, OpenAIApi = requ
ire("openai"); dotenv.config(); venom.create( session: 'bot-whatsapp', multidevice: true ) .then((client) => start(client)) .catch((error) => console.log(error); ); const configuration = new Configuration( organization: process.env.ORGANIZATION_ID, apiKey: process.env.OPENAI_API_KEY, ); const openai = new OpenAIApi(configuration); const getGPT3Response = async (clientText) => const options = model: "text-davinci-003", prompt: clientText, temperature: 1, max_tokens: 4000 try const response = await openai.createCompletion(options) let botResponse = "" response.data.choices.forEach(( text ) => botResponse += text ) return `Chat GPT ??\n\n $botResponse.trim()` catch (e) return `? OpenAI Response Error: $e.response.data.error.message` const commands = (client, message) => const iaCommands = davinci3: "/bot", let firstWord = message.text.substring(0, message.text.indexOf(" ")); switch (firstWord) case iaCommands.davinci3: const question = message.text.substring(message.text.indexOf(" ")); getGPT3Response(question).then((response) => /* * Faremos uma validação no message.from * para caso a gente envie um comando * a response não seja enviada para * nosso próprio número e sim para * a pessoa ou grupo para o qual eu enviei */ client.sendText(message.from === process.env.PHONE_NUMBER ? message.to : message.from, response) ) break; async function start(client) client.onAnyMessage((message) => commands(client, message)); Agora teste o funcionamento e veja se a integração está funcionando digitando esse comando abaixo no terminal do servidor: node gpt.js Se estiver tudo certo, será exibido um QRCode para você autorizar o navegador dessa aplicação a usar o seu WhatsApp Depois disso, poderá testar digitando qualquer frase ou pergunta iniciando por "/bot" Então o bot vai responder você com a inteligência artificial configurada no código do arquivo gpt.js [caption id="attachment_1014" align="alignnone" width="300"] Resposta do chat gpt-3[/caption] Bom é isso, espero que esse passo a passo ajude você. Reiterando que utilizei um servidor somente para essa finalidade, ou seja, para fins de testes. Referencias para publicação desse passo a passo: https://github.com/victorharry/zap-gpt https://platform.openai.com https://github.com/orkestral/venom
0 notes
computingpostcom · 3 years ago
Text
Xen Orchestra (XO) is a web interface tool for Xen and XCP-ng Administrators to visualize and administer the complete Virtualization stack. The Xen Orchestra doesn’t require an agent installed on the Desktop machine for it work. All operations are performed from a web interface. On the VM that hosts Xen Orchestra below are the minimal hardware requirements: 2 vCPUs 2GiB of RAM 20GiB of free SR space (2GiB on thin pro SR) The installation can be done on an instance running in XCP-ng or any other virtualization environment provided connectivity to Xen/XCP-ng servers is available. To use a ready appliance refer to Deploying Xen Orchestra Appliance on Xen/XCP-ng from CLI Step 1: Update System Let’s start the installation by updating all the system packages: sudo apt update Also consider performing an upgrade: sudo apt upgrade -y With the upgrade done you can reboot now or at later stage. Step 2: Install Node.js 14 on Ubuntu | Debian The next step is the installation of Node.js on Ubuntu / Debian Linux system: curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - Once the repository is added proceed to install Node.js: sudo apt install -y nodejs To install the Yarn package manager, run: curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update && sudo apt-get install yarn Confirm installation of Node.js and Yarn $ node -v v14.16.1 $ yarn -v 1.22.5 Step 3: Install XO packages on Ubuntu 20.04|Debian 10 Install Python: #For Python 2 sudo apt install python2-minimal #For Python 3 sudo apt install python3-minimal Install XO packages on Ubuntu 20.04|Debian 10 by running the commands below: sudo apt update sudo apt install build-essential redis-server libpng-dev git libvhdi-utils lvm2 cifs-utils Confirm package installations: The following NEW packages will be installed: binutils binutils-common binutils-x86-64-linux-gnu build-essential cifs-utils cpp cpp-9 dpkg-dev fakeroot g++ g++-9 gcc gcc-9 gcc-9-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbfio1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1 libhiredis0.14 libisl22 libitm1 libjemalloc2 liblsan0 liblua5.1-0 libmpc3 libpng-dev libpng-tools libquadmath0 libstdc++-9-dev libtalloc2 libtevent0 libtsan0 libubsan1 libvhdi-utils libvhdi1 libwbclient0 linux-libc-dev lua-bitop lua-cjson make manpages-dev redis-server redis-tools zlib1g-dev 0 upgraded, 58 newly installed, 0 to remove and 0 not upgraded. Need to get 42.3 MB of archives. After this operation, 184 MB of additional disk space will be used. Do you want to continue? [Y/n] y Step 4: Fetch Xen Orchestra Code and Build it Next is to clone Xen Orchestra code from github: git clone -b master http://github.com/vatesfr/xen-orchestra Now that you have the code, you can enter the xen-orchestra directory cd xen-orchestra The start building of Xen Orchestra and install other dependency packages on Ubuntu / Debian system. $ yarn yarn install v1.22.5 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... warning [email protected]: Invalid bin field for "url-loader". info [email protected]: The platform "linux" is incompatible with this module. info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation. info [email protected]: The platform "linux" is incompatible with this module. info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation. [4/5] Linking dependencies... [5/5] Building fresh packages... Done in 180.55s. $ yarn build ... Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
[10:36:00] Finished 'buildStyles' after 6.95 s [10:36:00] Finished 'copyAssets' after 6.96 s Successfully compiled 129 files with Babel (17350ms). [10:37:55] Finished 'buildScripts' after 2.03 min [10:37:55] Finished 'build' after 2.03 min Done in 138.77s. Now you have to create a config file for xo-server: cd packages/xo-server sudo mkdir /etc/xo-server sudo cp sample.config.toml /etc/xo-server/config.toml In this config file, you can change default ports (80 and 443) for xo-server. If you are running the server as a non-root user, you will need to set the port to 1024 or higher. You can try to start xo-server to see if it works. You should have something like this: $ sudo yarn start yarn run v1.22.5 $ node bin/xo-server app-conf /home/jkmutai/xen-orchestra/packages/xo-server/config.toml +0ms app-conf /etc/xo-server/config.toml +6ms 2021-04-20T10:42:27.569Z xo:main INFO Configuration loaded. 2021-04-20T10:42:27.575Z xo:main INFO Web server listening on http://[::]:80 2021-04-20T10:42:27.651Z xo:mixins:hooks DEBUG start start… 2021-04-20T10:42:27.774Z xo:mixins:hooks WARN start failure error: Error: Command failed with exit code 5: vgchange -an Logical volume ubuntu-vg/ubuntu-lv contains a filesystem in use. Can't deactivate volume group "ubuntu-vg" with 1 open logical volume(s) at makeError (/home/jkmutai/xen-orchestra/node_modules/execa/lib/error.js:59:11) at handlePromise (/home/jkmutai/xen-orchestra/node_modules/execa/index.js:114:26) at processTicksAndRejections (internal/process/task_queues.js:93:5) shortMessage: 'Command failed with exit code 5: vgchange -an', command: 'vgchange -an', exitCode: 5, signal: undefined, signalDescription: undefined, stdout: '', stderr: ' Logical volume ubuntu-vg/ubuntu-lv contains a filesystem in use.\n' + ` Can't deactivate volume group "ubuntu-vg" with 1 open logical volume(s)`, failed: true, timedOut: false, isCanceled: false, killed: false app-conf /home/jkmutai/xen-orchestra/packages/xo-server/config.toml +219ms app-conf /etc/xo-server/config.toml +2ms 2021-04-20T10:42:27.799Z xo:xo-mixins:subjects INFO Default user created: [email protected] with password admin 2021-04-20T10:42:27.807Z xo:mixins:hooks DEBUG start finished 2021-04-20T10:42:27.808Z xo:mixins:hooks DEBUG clean start… 2021-04-20T10:42:27.822Z xo:mixins:hooks DEBUG clean finished 2021-04-20T10:42:27.931Z xo:main INFO Setting up / → /home/jkmutai/xen-orchestra/packages/xo-web/dist Use forever-service to install XO as a system service: $ sudo yarn global add forever yarn global v1.22.5 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Installed "[email protected]" with binaries: - forever Done in 21.97s. $ sudo yarn global add forever-service yarn global v1.22.5 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Installed "[email protected]" with binaries: - forever-service - get-forever-config Done in 8.77s. $ cd ~/xen-orchestra/packages/xo-server/bin/ $ sudo forever-service install orchestra -r root -s xo-server forever-service version 0.5.11 Platform - Ubuntu 20.04.2 LTS orchestra provisioned successfully Below are the commands to interact with service orchestra: Start - "sudo service orchestra start" Stop - "sudo service orchestra stop" Status - "sudo service orchestra status" Restart - "sudo service orchestra restart" Let’s start the service: sudo service orchestra start Confirm the service is running: $ sudo ss -tunelp | grep *:80 tcp LISTEN 0 511 *:80 *:* users:(("node",pid=269785,fd=18)) ino:1883628 sk:9 v6only:0 If you ever need to delete the service, run the command: sudo forever-service delete orchestra
Additionally install xo-cli tool. $ sudo npm install --global xo-cli npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support npm WARN deprecated [email protected]: looking for maintainer /usr/bin/xo-cli -> /usr/lib/node_modules/xo-cli/dist/index.js + [email protected] added 75 packages from 50 contributors in 26.199s Step 5: Access Xen Orchestra Web interface You can now access the web UI of Xen Orchestra by putting the IP you configured during deployment into your web browser. Use below default login credentials: Username: [email protected] Password: admin Navigate to “Settings” > “Users“ Select admin user and click “edit” under Password section to update user’s password. Step 6: Add XenServer | XCP-ng Server Add the Xen|XCP-ng server by going to “Home” > “Add server“ Input the server label, IP Address, Username and Password used to login. Confirm connection is successful You can now see existing Virtual Machines and create new ones from XO console.  
0 notes
ubuntu-server · 4 years ago
Text
How To Install Kuma on Ubuntu 20.04
How To Install Kuma on Ubuntu 20.04
Kuma is an open source monitoring tool like “Uptime Robot” written in Nodejs. In this article, we’ll learn how to install it on Ubuntu 20.04 so we can self-host our Uptime Bot. We’ll also set up a reverse proxy on Apache with a Let’s Encrypt SSL to secure our website. Kuma is easy to use and upgrade, and is powerful for traffic control, observability, service discovery, etc. Table of…
Tumblr media
View On WordPress
0 notes
candidroot01 · 4 years ago
Text
How To Install Odoo 15 In Ubuntu 18.04 ? | Steps To Install Odoo 15
How To Install Odoo 15 In Ubuntu 18.04 LTS ?
Technical
Steps To Install Odoo 15 On Ubuntu 18.04 
Odoo is the most popular all-in-one business software in the world.To Install Odoo 15 on Ubuntu 18.04 you just need to follow the below steps. There are many ways to install Odoo depending on the requirements and the easy and quick way to install Odoo by using APT repositories. If you want to work with running multiple Odoo versions on the same system then you can either use docker compose or docker Install Odoo in a virtual environment. This blog is to provide steps for installation and configuration of Odoo for production environment using Git source and Python environment on an Ubuntu 18.04 system. Note : Odoo 15 is not launched yet so we have used the “master” branch for Installation.
To install Odoo 15 on Ubuntu 18.04 LTS you just follow the below steps.
  Step 1 : Update Server
sudo apt-get update
                                           sudo apt-get upgrade -y
                    Step 2 : Create Odoo User in Ubuntu
                       sudo adduser -system -home=/opt/odoo -group odoo
                    Step 3 : Install PostgreSQL Server
                       sudo apt-get install postgresql -y
                    Step 4 : Create Odoo user for postgreSQL
                       sudo su - postgres -c "createuser -s odoo" 2> /dev/null || true
                    Step 5 : Install Python Dependencies
                       sudo apt-get install git python3 python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libjpeg-dev gdebi -y
                    Step 6 : Install Python PIP Dependencies
sudo -H pip3 install -r https://raw.githubusercontent.com/odoo/odoo/master/requirements.txt
                    Step 7 : Install other required packages
                       sudo apt-get install nodejs npm -y
                   sudo npm install -g rtlcss
                    Step 8 : Install Wkhtmltopdf
                       sudo apt-get install xfonts-75dpi
                   sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
                   sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
                   sudo cp /usr/local/bin/wkhtmltoimage  /usr/bin/wkhtmltoimage
                   sudo cp /usr/local/bin/wkhtmltopdf  /usr/bin/wkhtmltopdf
                    Step 9 : Create Log directory
                       sudo mkdir /var/log/odoo
                    sudo chown odoo:odoo /var/log/odoo
                    Step 10 :Install Odoo
                       sudo apt-get install git
                   sudo git clone --depth 1 --branch master https://www.github.com/odoo/odoo /odoo/odoo-server
                    Step 11 : Setting permissions on home folder
                       sudo chown -R odoo:odoo /odoo/*
                    Step 12 : Create server config file
                       sudo touch /etc/odoo-server.conf
                   sudo su root -c "printf '[options] \n; This is the password that allows database operations:\n' >> /etc/odoo-server.conf"
                   sudo su root -c "printf 'admin_passwd = admin\n' >> /etc/odoo-server.conf"
                   sudo su root -c "printf 'xmlrpc_port = 8069\n' >> /etc/odoo-server.conf"
                   sudo su root -c "printf 'logfile = /var/log/odoo/odoo-server.log\n' >> /etc/odoo-server.conf"
                   sudo su root -c "printf 'addons_path=/odoo/odoo-server/addons\n' >> /etc/odoo-server.conf"
                   sudo chown odoo:odoo /etc/odoo-server.conf
                   sudo chmod 640 /etc/odoo-server.conf
                    Step 13 : Now Start Odoo
                       sudo su - odoo -s /bin/bash
                   cd /odoo/odoo-server
                   ./odoo-bin -c /etc/odoo-server.conf
0 notes
candidroot · 4 years ago
Text
How To Install Odoo 15 In Ubuntu 18.04 LTS ?
Tumblr media
Steps To Install Odoo 15 On Ubuntu 18.04
Odoo is the most popular all-in-one business software in the world.To Install Odoo 15 on Ubuntu 18.04 you just need to follow the below steps. There are many ways to install Odoo depending on the requirements and the easy and quick way to install Odoo by using APT repositories. If you want to work with running multiple Odoo versions on the same system then you can either use docker compose or docker Install Odoo in a virtual environment. This blog is to provide steps for installation and configuration of Odoo for production environment using Git source and Python environment on an Ubuntu 18.04system. Note: Odoo 15 is not launched yet so we have used the “master” branch for Installation.
To install Odoo 15 on Ubuntu 18.04 LTS you just follow the below steps.
Step 1 : Update Server
sudo apt-get updatesudo apt-get upgrade -y
Step 2 : Create Odoo User in Ubuntu
sudo adduser -system -home=/opt/odoo -group odoo
Step 3 : Install PostgreSQL Server
sudo apt-get install postgresql -y
Step 4 : Create Odoo user for postgreSQL
sudo su - postgres -c "createuser -s odoo" 2> /dev/null || true
Step 5 : Install Python Dependencies
sudo apt-get install git python3 python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libjpeg-dev gdebi -y
Step 6 : Install Python PIP Dependencies
sudo -H pip3 install -r https://raw.githubusercontent.com/odoo/odoo/master/requirements.txt
Step 7 : Install other required packages
sudo apt-get install nodejs npm –ysudo npm install -g rtlcss
Step 8 : Install Wkhtmltopdf
sudo apt-get install xfonts-75dpisudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.debsudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.debsudo cp /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimagesudo cp /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
Step 9 : Create Log directory
sudo mkdir /var/log/odoosudo chown odoo:odoo /var/log/odoo
Step 10 :Install Odoo
sudo apt-get install gitsudo git clone --depth 1 --branch master https://www.github.com/odoo/odoo /odoo/odoo-server
Step 11 : Setting permissions on home folder
sudo chown -R odoo:odoo /odoo/*
Step 12 : Create server config file
sudo touch /etc/odoo-server.confsudo su root -c "printf '[options] \n; This is the password that allows database operations:\n' >> /etc/odoo-server.conf"sudo su root -c "printf 'admin_passwd = admin\n' >> /etc/odoo-server.conf"sudo su root -c "printf 'xmlrpc_port = 8069\n' >> /etc/odoo-server.conf"sudo su root -c "printf 'logfile = /var/log/odoo/odoo-server.log\n' >> /etc/odoo-server.conf"sudo su root -c "printf 'addons_path=/odoo/odoo-server/addons\n' >> /etc/odoo-server.conf"sudo chown odoo:odoo /etc/odoo-server.confsudo chmod 640 /etc/odoo-server.conf
Step 13 : Now Start Odoo
sudo su - odoo -s /bin/bashcd /odoo/odoo-server./odoo-bin -c /etc/odoo-server.conf
Now your odoo instance is up and running.
Go to web browser and access your odoo at localhost:8069
0 notes
365bl0ggy · 4 years ago
Text
Odoo 14 Installation On Ubuntu 20.04
How To Install Odoo 14 In Ubuntu 20.04?
Tumblr media
Steps For Odoo 14 Installation On Ubuntu 20.04
There are many ways for Odoo 14 Installation On Ubuntu 20.04 but here we are giving steps to install using Git Repository.
Step 1: Update Server
sudo apt-get update
sudo apt-get upgrade -y
Step 2: Create Odoo User in Ubuntu
sudo adduser -system -home=/opt/odoo -group odoo
Step 3: Install PostgreSQL Server
sudo apt-get install postgresql -y
Step 4: Create Odoo user for postgreSQL
sudo su - postgres -c "createuser -s odoo" 2> /dev/null || true
Step 5: Install Python Dependencies
sudo apt-get install git python3 python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libjpeg-dev gdebi -y
Step 6: Install Python PIP Dependencies
sudo apt-get install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev
sudo -H pip3 install -r https://raw.githubusercontent.com/odoo/odoo/master/requirements.txt
Step 7: Install other required packages
sudo apt-get install nodejs npm -y
sudo npm install -g rtlcss
Step 8: Install Wkhtmltopdf
sudo apt-get install xfonts-75dpi
sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
Step 9: Create Log directory
sudo mkdir /var/log/odoo
sudo chown odoo:odoo /var/log/odoo
Step 10: Install ODOO
sudo apt-get install git
sudo git clone --depth 1 --branch 14.0 https://www.github.com/odoo/odoo /odoo/odoo-server
Step 11: Setting permissions on home folder
sudo chown -R odoo:odoo /odoo/*
Step 12: Create server config file
sudo touch /etc/odoo-server.conf
sudo su root -c "printf '[options] \n; This is the password that allows database operations:\n' >> /etc/odoo-server.conf"
sudo su root -c "printf 'admin_passwd = admin\n' >> /etc/odoo-server.conf"
sudo su root -c "printf 'xmlrpc_port = 8069\n' >> /etc/odoo-server.conf"
sudo su root -c "printf 'logfile = /var/log/odoo/odoo-server.log\n' >> /etc/odoo-server.conf"
sudo su root -c "printf 'addons_path=/odoo/odoo-server/addons\n' >> /etc/odoo-server.conf"
sudo chown odoo:odoo /etc/odoo-server.conf
sudo chmod 640 /etc/odoo-server.conf
Step 13: Now Start Odoo
sudo su - odoo -s /bin/bash
cd /odoo/odoo-server
./odoo-bin -c /etc/odoo-server.conf
Now your odoo instance is up and running. 
Go to web browser and access your Odoo at localhost: 8069
Source: Odoo Installation Blog
Check Our Other Technology Related Blogs, Here
0 notes
mbaljeetsingh · 4 years ago
Text
How to Deploy a Node.js App – From Server Setup to Production
In this tutorial, we are going to learn everything we need to know before deploying a Node app to a production server.
We will start by renting a server on Digital Ocean. Then we'll configure this server, connect to it, install Nginx and configure it, pull or create our Node app, and run it as a process.
As you can see, there is a lot to do and it will be an action-packed tutorial. So let's get started without wasting any time.
You should have some basic knowledge on how the Terminal works and how to work in Vi/Vim before getting started. If you are not familiar with basic commands, I would advise you to read up on them a bit.
I will run the commands in MacOS. If you want to follow this tutorial in Windows, you can use Powershell or some other Unix emulator of your choice.
Although I will use Node.js as the platform of our example application, most of the steps are the same for any web application.
Why Digital Ocean?
I choose Digital Ocean because it is cheap and the interface is really easy to use, compared to the likes of AWS. Also, a $100 credit is included in the GitHub student pack so you do not have to pay anything for a couple of months. It is ideal for deploying a course or hobby project.
It has a concept called Droplets, which is basically your share of a server. You can think of the server as an apartment in which you own or rent a flat.
Droplets work with the help of Virtual Machines which run on the server. So a Droplet is your Virtual Machine on a shared server. Since it is a VM, its CPU and memory share can be easily increased, usually by throwing more money at your provider.
How to Create a Digital Ocean Project
Tumblr media
I am assuming that you have already signed up and logged in to Digital Ocean before proceeding. We should first create a project that will contain our droplets. Let's click on the new project button on the left side menu. It will ask you to name your project.
Tumblr media
Enter whatever name you want. It will also ask you if you want to move any resources, but for now just click Skip – we will create the droplet later.
How to Create a Droplet on Digital Ocean
Let's create our droplet by clicking the Get Started button.
Tumblr media
After clicking the button, it will ask us to choose a VM image.
Tumblr media
Choosing an Image
On this page, I will select Ubuntu 20.04 since it is the latest LTS version at the time I am writing this post. LTS means "Long Term Support". It is best to go with the LTS version for actual projects, because the provider guarantees that it will be supported and maintained for a long time. This means you will not have problems in the long run.
I have chosen Ubuntu, and would recommend it to you since it is the most commonly used Linux distribution. This means it's also the easiest to find answers to your future questions.
You can also choose to have a Dedicated CPU if you need it. If you are building your own startup or any business project, I would recommend reading this post which contains detailed instructions about how to pick the right option for you.
I will go with the cheapest option in this case.
Then you will need to select a Datacenter region. You should pick the one that is closest to you to minimize network delay.
Tumblr media
Select a Datacenter
Next let's select SSH Keys as the Authentication Method, since it is much more secure than basic password authentication.
Tumblr media
Authentication Method
To connect to the server we need to generate a new SSH key on our own device and add it to Digital Ocean.
How to Generate an SSH Key
I will generate the key on my macOS device. If you are using Windows you can refer to this article. Open your terminal and move into the ssh folder:
cd ~/.ssh
Then create your SSH key:
ssh-keygen
If your computer says that it does not know this command, you should install it via brew.
Tumblr media
It will ask you to name the file and enter a passphrase. Do not enter a name, just press enter and go with the defaults. You should have these files generated. I have named mine digital-ocean-ssh in this screenshot, so do not get confused by that.
❯ lsid_dsa id_rsa known_hosts
Our public key is the id_dsa and the id_rsa is our private key. If you forget which one is private, you can always print one of them to see.
How to Add Your SSH Key to Digital Ocean
Now we want to copy our public key and upload it to Digital Ocean so they will know which key to use in authentication.
Tumblr media
Copy this whole key including the ssh-rsa part.
Click on "New SSH Key":
Tumblr media
Paste the key in the textbox that appears after you click the button and you should see your SSH key.
Tumblr media
How to Connect to the Server
We will use the terminal to connect to our server with SSH. You can also take a look at Termius for a nice interface if you want.
Run this command in your terminal after replacing the IP_ADDRESS with your server's IP address (you can look it up from Digital Ocean's panel).
ssh root@IP_ADDRESS
If everything goes well, now you should be in the server's terminal. We have successfully connected to server. If there is any error, you can debug it by running the command with the "-v" option or "-vv" for even more verbosity.
How to Set Up the Server
We need to do some initial setup before deploying the Node app to the server.
Update and Upgrade Software
We want to update the server's software to make sure we are using the latest versions.
Many servers are vulnerable to attacks because they are using older versions of software with known vulnerabilities. Attackers can search for the vulnerabilities in those software and try to exploit them in order to gain access to your server.
You can update Ubuntu's software using the "apt update" command.
apt updateHit:1 https://repos.insights.digitalocean.com/apt/do-agent main InReleaseGet:2 http://mirrors.digitalocean.com/ubuntu focal InRelease [265 kB] Hit:3 http://mirrors.digitalocean.com/ubuntu focal-updates InRelease Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]Hit:5 http://mirrors.digitalocean.com/ubuntu focal-backports InReleaseFetched 374 kB in 1s (662 kB/s) Reading package lists... DoneBuilding dependency tree Reading state information... Done96 packages can be upgraded. Run 'apt list --upgradable' to see them.
If you read the message, it says that "96 packages can be upgraded". We have installed the new software packages but we have not upgraded our software to those versions yet.
To do that, let's run another command:
apt upgrade
Type y when it prompts you and it will upgrade the software.
Create a User
We have connected to the server as the root user (the user with the highest privileges). Being the root is dangerous and can open us up to vulnerabilities.
Therefore we should create a new user and not run commands as root. Replace $username with a username of your choice.
whoamiroot
adduser $username
You need to enter a password for the user. After that point, it will ask a bunch of questions, so just input y until the prompting is over.
The new user has been created but we also need to add this new user to the "sudo" group so that we can perform any action we need.
usermod -aG sudo $USERNAME
We add group with the -aG (add group) option, and we add the group name sudo to our username.
We are still root, so let's switch our user to the newly created user, using the su (switch user) command.
su $USERNAME
After this point, if you run whoami command, you should see your username. You can confirm the existence of the sudo group by running this command:
sudo cat /var/log/auth.log
Only superusers can view this file and OS will ask for your user password after you run this command.
Copy the SSH Key
We have successfully created the user but we have not enabled SSH login for this new user yet.
Therefore, we have to copy the public key that we previously created on our local computer and paste it into this user's SSH folder so SSH can know which key should it use to authenticate our new user.
mkdir -p ~/.ssh
The -p argument creates the directory if it does not exist.
vi ~/.ssh/authorized_keys
We will use vi or vim to create a file and call it authorized_keys.
Copy your public key (`id_dsa` file) then press "i" to go into insert mode. Then just paste it into this file with CMD + V.
Press esc to quit insert mode, type :wq to save and quit.
If you have any problems about using Vim-Vi, you can check out one of the many tutorials that explain how to use it.
Connect to Server as New User
Now we should be able to connect to the server without any problems using ssh. You can use this command to connect, just remember to insert your username and IP_ADDRESS.
ssh $USERNAME@IP_ADDRESS
If you are having any problems at this point, you should just delete the droplet and start over. It does not take a lot of time to start over but debugging server problems can be difficult.
How to Disable Root Login
It is a good practice to disable Root login as a security precaution, so let's do that now.
It can be useful to change the file permission just in case so that we won't run into problems regarding permissions in the future.
chmod 644 ~/.ssh/authorized_keys
Let's now open our sshd_config file:
sudo vi /etc/ssh/sshd_config
Find this line and change the yes to no in the same way we did earlier with vi.
PermitRootLogin no
Save and quit vi.
How to Install Node.js and Git
We can now go ahead and install Node.js and Git:
sudo apt install nodejs npm
sudo apt install git
We are now ready to create a Node app and run it. You can either pull your Node project from Github or create a Node app here just to test if it works.
Move to a directory of your choice and create an "app.js" file:
sudo vi app.js
You can paste the following snippet into your app.js file:
const express = require('express');const app = express();const port = 3000;app.get('/', (req, res) => { res.send('Hello World');});app.listen(port, () => console.log(`Example app listening on port ${port}!`));
Now we can run it with the command:
node app.js
You should see "Example app listening on port 3000!" on your terminal.
We can confirm that it is working by sending a request to our server:
GET http://IP_ADDRESS:3000/
Send this request either from an HTTP client like Postman or your browser and you should see the "Hello World" message.
At this point, you should notice that something is wrong: Regular users do not know how to send requests to port 3000.
We should redirect the requests that come to our web server from our IP to port 3000. We can accomplish this with the help of Nginx.
Tumblr media
How to Install and Configure Nginx
We will use Nginx as a Reverse Proxy to redirect the requests to our Node app.
Tumblr media
Nginx as a Reverse Proxy
Let's install Nginx:
sudo apt install nginx
Start the Nginx service:
sudo service nginx start
We can test to see if it is working by sending a request to our server's IP address from the browser. Type your server's IP address to your browser and you should see this:
Tumblr media
It is important to know that Nginx serves from "/var/www/html" by default and you can find this HTML file in that directory as well.
I also advise you to create a folder under "/var/www", call it app, and move your Node app to that folder so it will be easy to find.
How to Configure the Nginx Reverse Proxy
We will edit the Nginx config file to configure a reverse proxy:
sudo vi /etc/nginx/sites-available/default
In this file you need to find the location / block and change it as follows:
location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. proxy_pass http://127.0.0.1:3000/; }
The proxy_pass directive proxies the request to a specified port. We give the port that our Node application is running on.
Let's restart Nginx so the changes can take effect:
sudo service nginx reload
After this step, we should be able to see the message when we send a request to our server. Congratulations, we have completed the minimum number of steps to deploy a Node app!
Tumblr media
But I still advise you to complete the following bonus step as well, as I believe it's quite important.
If you can't see the hello world message, you can check if your app and Nginx are running and restart them.
How to Run your App as a Process
We do not want to start our application manually every time something goes wrong and our app crashes. We want it to restart on its own. Also, whenever the server starts, our app should start too.
To make this happen, we can use PM2. Let's install PM2 and configure it.
sudo npm i -g pm2
We are installing pm2 globally by using the "-g" option so that it will be accessible from every folder.
pm2 start app.js
This makes sure that the app will restart if it exits due to an error.
Let's save the current process list.
pm2 save
We also need to convert it to a daemon that runs whenever the system starts:
pm2 startup systemd
Tumblr media
As a reminder, in this tutorial, I'm using the commands for Ubuntu. If you are using any other Linux distro, you should replace systemd in this command.
We can confirm that the service is getting restarted by rebooting the server and sending a request without running app.js by hand:
sudo reboot
After sending a request as we did earlier, you should be able to see the hello world message.
Conclusion
In this tutorial we started from scratch, rented a server for ourselves, connected to it, and configured it in a way that it serves our Node.js app from port 80.
If you have followed along and were able to complete all steps, congratulations! You can be proud of yourself, as this was not the easiest topic :). I hope that you have learned a lot. Thank you for your time.
I am planning to explore this topic further by connecting the server to a domain name, then connecting it to CircleCI for continuous integration. I'll also go through the required steps to make your Node.js/React app production ready. This post had already gotten long enough, though, so those topics are reserved for another post :)
If you have enjoyed reading and want to get informed about my future posts, you can subscribe to my personal blog. You can see my previous posts there if you are interested in reading more. I usually write about web development-related topics.
0 notes
tutorials-website · 5 years ago
Link
we’ll cover all methods of how to upgrade NodeJs to Latest version in Linux Os, Ubuntu Os, Windows 7, 8, 10, and Mac Osx using NPM (Node Package Manager) and NVM (Node Version Manager).
0 notes
holytheoristtastemaker · 5 years ago
Link
Tumblr media
Disclaimer: I’m writing about my experience with major OS (Windows 10, macOs High/Sierra, Ubuntu/Manjaro) using a Solid State Drive. It has a huge impact in term of speed and it could be different from your own experience.
Hello there. To begin with, this post isn’t about what’s the best OS for everyday programming, it could depend on the stack used, Misc programs and specially YOU, so i’ll try to describe all the good/bad things that happened during my everyday workflows.
But before that I should let you know my programming stack so you won't get confused later. I mainly use:
PHP frameworks and CMS
nodejs frameworks for frontend
react native/ionic for mobile dev
Photoshop (with CssHat) for HTML Integration, banner for mobile apps.
ms office due to my current job.[1]
Ubuntu (Unity/Gnome):
By the end of 2015 and after a good run with Windows 7 and using Ubuntu just occasionally in virtual machines I thought I would give it a shot with a daily usage so I installed the 15.10 version. back then i was programming in PHP, Java and C# (because of my Software engineering Studies), php and apache had great performances locally, same for java but used a windows 7 VM for Visual Studio, Ms Office and Adobe Photoshop, because all the alternatives (Darkable/Gimp, Open office) weren't at the same levels. I tried but the more you use them the more you notice their weak points such as ease of use, backward compatibility.
I had a good (exactly 2 years) run switching between Unity and Gnome DE (I was the n°1 hater for KDE btw), but over time and even with SSD it felt a kinda slow (I was always stuck with 16.04 LTS) and honestly, I wasn’t fan of the Ubuntu’s PPAs either and then I discovered the Hackintosh community.
macOs (10.12/10.14)
So after a hell of an installation process I managed to run macOs Sierra smoothly on a laptop that has hardware near to macbook pro late 2012 (HP elitebook 840 G1). Apps installed with one simple drag n’ drop (applies to android studio too). It run the Android Virtual Device smoother than windows 7 and ubuntu with the same laptop, i was very surprised, the memory management, the apps integration and the overall stability was so great. At that time I finished my studies so no more Java or .Net programming, and the adobe/ms office suite was a strong point compared to Linux in general so every program ran natively without the need of any VM, with our beloved Unix cli.
The only drawback I had with mac, or with hackintosh, is the system updates/upgrades it was so painful to do it breaks your system every time, I was backing up the whole bootable system image whenever I attempted to update. Because the Kexts (Kernel extensions or “drivers”) weren’t always backward compatible.
So in the end i was thinking to go back to linux again but not sure which distribution i will stick with again, I wanted a stable distro that i forgot completely about something called upgrades of “big updates”. In the meantime I give Windows 10 another shot after hearing it got better and better in the last years.
And again, after 2 years with no workflow complaints I backed up my hackintosh installation and installed the last build of windows 10.
Windows 10.
I’ll resume my experience with one line: “not great, not terrible” Compared, again, to mac os the system was very smooth in every way, snapping windows, switching virtual desktops, programs and files search in the start menu, no problem but! I already missed the unix cli. Yeah I know there’s cmder and other tools. The overall performance was okay but there was some latency when compiling node js apps. My workflow didn’t change. I used Laragon for all my php projects with phpstorm and it was perfect honestly. On the other hand Android Emulator was terrible even with 8gb or ram and ssd, mac os was handling it way better.
In the meantime I played with some linux distros in VMs and made the choice: Manjaro, KDE flavor.
Manjaro:
“You said you hated KDE right?” well yes but for a cause, one I didn’t want to bring back the Gnome memories i had with Ubuntu and second, I disliked is because its similarity in UI compared to Windows in general, 10 specially then I found how very customizable was and again i’ll resume it with one line: “everything is a widget”. So in term of UI I made my simple comfortable setup.
Now in term of programs and workflow I still use PhpStorm for my php and nodejs projects, npm and yarn installed globally and surprisingly npm run very fast compared to windows and mac; git already installed, but for my php projects I migrate all of them to docker with docker compose, majority of projects were based on Laravel, Prestashop, Wordpress and old native php apps. I managed to dockerize some of them from scratch, some with Laradock.
Java/.Net: RIP.
For mobile development there were some struggles during configuring ionic and react native’s first run but done with them quickly, no problem with android studio but the emulator “again” wasn’t that good as mac os, but not that bad like windows. And I discovered a helpful package that cast my connected android device to my screen and it’s shown as a virtual device but a physical one, called scrcpy from the genymotion team!
And finally these are just some of the benefits why I picked manjaro:
No big breaking updates.
A rolling release distro.
Fast security patches.
The Great Arch User Repository (AUR)
Snap and Flatpak support (but why?)
Very stable.
But still there are some drawback, linux’s ones in general:
Still needing photoshop and lightroom.
Ms Office for work purpose (Managed to use Web version since we have ms365 but still miss Excel for heavy use)
Conclusion:
Finally and personally I’ll stick with linux for these main two reasons: native support for docker (future projects could be deployed with it) and the unix environment similarity to production servers (cli, ssh and packages’ configuration). I understand many of you will disagree for many things said in the post but that’s okay! because, finally, we choose what will help us to give the most of us in terms of productivity.
Thank you all for reading the most boring post ever made on Dev.to platform! I would gladly hear from you some of your thoughts and experiences as well. Thanks again! [1]
[1]: edit. added used stack and a conclusion.
0 notes
zockainternet · 2 years ago
Text
Nesse passo a passo estarei mostrando um exemplo de como integrar um chat bot GPT-3 que é uma API da OPENAI, que criou o ChatGPT.   Integrando Chat GPT com WhatsApp Para fazer esse procedimento estou usando um servidor com Debian (mas já testei o funcionamento com ubuntu 18...). A integração está sendo feita com: node.js venom-bot api da openai OBS IMPORTANTE: Nos testes que realizei, criei um servidor apenas para essa finalidade, se você não tiver conhecimento técnico suficiente para entender o que está sendo feito, sugiro que instale em uma maquina virtual. Neste exemplo, estou utilizando usuário "root" para fazer todo procedimento.   Instalando o node.js e atualizando o servidor Vamos começar atualizando o sistema e instalando node.js no servidor: sudo apt-get update -y && apt-get upgrade -y curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - sudo apt-get update sudo apt install nodejs -y Depois disso, vamos instalar as dependências no servidor: sudo apt-get update sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev Após a instalações dessas bibliotecas, considere reiniciar o servidor. Prosseguindo, agora vamos instalar o venom-bot que será responsavel por conectar o chatbot ao WhatsApp: cd /root mkdir chatbot-whatsapp cd chatbot-whatsapp touch index.js npm i venom-bot No arquivo index, você vai colocar esse código: const venom = require('venom-bot'); venom .create() .then((client) => start(client)); function start(client) client.onMessage((message) => message.body === 'Oi') client .sendText(message.from, 'Estou pronto!') .then((result) => console.log('Result: ', result); //retorna um objeto de successo ) .catch((erro) => console.error('Erro ao enviar mensagem: ', erro); //return um objeto de erro ); ); Agora teste o funcionamento e veja se o chatbot está funcionando digitando esse comando abaixo no terminal do servidor: node index.js Se estiver tudo certo, será exibido um QRCode para você autorizar o navegador dessa aplicação a usar o seu WhatsApp [caption id="attachment_1011" align="alignnone" width="300"] Exemplo de QRCode do chatbot[/caption] Depois disso, poderá testar digitando um "Olá" ou "Oi" para o WhatsApp conectado ao chatbot. E ele deverá responder pra você "Estou pronto!" [caption id="attachment_1012" align="alignnone" width="300"] Exemplo de resposta do chatbot[/caption] Se até essa etapa está tudo ok, podemos prosseguir.   Instalando a API do OPenAI e integrando com WhatsApp Agora vamos para integração com a api do openai, vamos fazer a integração do gpt-3 com o WhatsApp Para isso, vamos instalar a api do openai: cd /root/chatbot-whatsapp npm i openai Deverá criar um arquivo chamado ".env" com suas credenciais de acesso do openai (organização e api de acesso). OBS IMPORTANTE: é necessário se cadastrar no site da openai.com Depois disso poderá adquirir as informações nos seguintes links: OPENAI_API_KEY=https://platform.openai.com/account/api-keys ORGANIZATION_ID=https://platform.openai.com/account/org-settings Já o "PHONE_NUMBER=" é o numero do WhatsApp que você vai colocar no qrcode. touch .env echo "OPENAI_API_KEY=COLEAQUISUAAPI" >> /root/chatbot-whatsapp/.env echo "ORGANIZATION_ID=COLEAQUISUAORGANIZACAO" >> /root/chatbot-whatsapp/.env echo "[email protected]" >> /root/chatbot-whatsapp/.env Agora você pode substituir o có
digo do arquivo index, ou criar um novo arquivo para testar, neste exemplo estou criando um novo arquivo: touch gpt.js E deverá colocar o seguinte código nele: const venom = require('venom-bot'); const dotenv = require('dotenv'); const Configuration, OpenAIApi = require("openai"); dotenv.config(); venom.create( session: 'bot-whatsapp', multidevice: true ) .then((client) => start(client)) .catch((error) => console.log(error); ); const configuration = new Configuration( organization: process.env.ORGANIZATION_ID, apiKey: process.env.OPENAI_API_KEY, ); const openai = new OpenAIApi(configuration); const getGPT3Response = async (clientText) => const options = model: "text-davinci-003", prompt: clientText, temperature: 1, max_tokens: 4000 try const response = await openai.createCompletion(options) let botResponse = "" response.data.choices.forEach(( text ) => botResponse += text ) return `Chat GPT ??\n\n $botResponse.trim()` catch (e) return `? OpenAI Response Error: $e.response.data.error.message` const commands = (client, message) => const iaCommands = davinci3: "/bot", let firstWord = message.text.substring(0, message.text.indexOf(" ")); switch (firstWord) case iaCommands.davinci3: const question = message.text.substring(message.text.indexOf(" ")); getGPT3Response(question).then((response) => /* * Faremos uma validação no message.from * para caso a gente envie um comando * a response não seja enviada para * nosso próprio número e sim para * a pessoa ou grupo para o qual eu enviei */ client.sendText(message.from === process.env.PHONE_NUMBER ? message.to : message.from, response) ) break; async function start(client) client.onAnyMessage((message) => commands(client, message)); Agora teste o funcionamento e veja se a integração está funcionando digitando esse comando abaixo no terminal do servidor: node gpt.js Se estiver tudo certo, será exibido um QRCode para você autorizar o navegador dessa aplicação a usar o seu WhatsApp Depois disso, poderá testar digitando qualquer frase ou pergunta iniciando por "/bot" Então o bot vai responder você com a inteligência artificial configurada no código do arquivo gpt.js [caption id="attachment_1014" align="alignnone" width="300"] Resposta do chat gpt-3[/caption] Bom é isso, espero que esse passo a passo ajude você. Reiterando que utilizei um servidor somente para essa finalidade, ou seja, para fins de testes. Referencias para publicação desse passo a passo: https://github.com/victorharry/zap-gpt https://platform.openai.com https://github.com/orkestral/venom
0 notes
sololinuxes · 5 years ago
Text
Instalar Postal Mail Server en Ubuntu 18.04 / 20.04
Tumblr media
Instalar Postal Mail Server en Ubuntu 18.04 / 20.04. Tal vez no lo conozcas, pero Postal Mail Server es un servidor de correo muy completo, que cuenta con todas las funciones necesarias para manejar las cuentas de mail tanto de sitios web como de servidores específicos para ello. Seguro que conoces Sendgrid, Mailgun o Postmark, con Postal Mail Server puedes lograr algo similar. El servidor del que hoy hablamos, nos proporciona una API HTTP que permite integrarlo con otros servicios y enviar correos electrónicos desde diferentes sitios o aplicaciones web. Destacamos su alta detección de spam y virus. Instalar y configurar Postal Mail Server es una tarea sencilla si lo comparamos con otros alternativas. El único requisito que debes cumplir es que los registros del dominio principal apunten de manera efectiva al servidor antes de comenzar su instalación.
Tumblr media
Instalar Postal Mail Server  
Instalar Postal Mail Server en Ubuntu
Comenzamos actualizando el sistema para continuar con la instalación de MariaDB. sudo apt update sudo apt dist-upgrade   Instalar MariaDB sudo apt install mariadb-server libmysqlclient-dev Iniciamos y habilitamos MariaDB. sudo systemctl start mariadb.service sudo systemctl enable mariadb.service Ahora aseguramos el servidor de base de datos. sudo mysql_secure_installation Una manera efectiva de proteger MariaDB es siguiendo los pasos que te indico a continuación. Enter current password for root (enter for none):  Pulsa Enter Set root password? :  Y New password:  Introduce el password Re-enter new password:  Repite el password Remove anonymous users? :  Y Disallow root login remotely? :  Y Remove test database and access to it? :  Y Reload privilege tables now? :  Y Reiniciamos MariaDB. sudo systemctl restart mariadb.service   Crear una base de datos Creamos una base de datos en blanco para Postal Mail Server, te pedira la password que insertaste en el paso anterior. sudo mysql -u root -p La nueva base de datos se llamará "postal" (como ejemplo). CREATE DATABASE postal CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci; Ahora creamos el usuario "postaluser" y una nueva contraseña para el. CREATE USER 'postaluser'@'localhost' IDENTIFIED BY 'tu_password'; Le damos permisos de acceso al nuevo usuario. GRANT ALL ON postal.* TO 'postaluser'@'localhost' WITH GRANT OPTION; Solo nos falta guardar y salir de la consola de MariaDB. FLUSH PRIVILEGES; EXIT;   Instalar Ruby, Erlang y RabbitMQ Los paquetes Ruby, Erlang y RabbitMQ (necesarios), no están disponibles en los repositorios oficiales de Ubuntu, los instalamos manualmente. Para instalar Ruby sigue los pasos indicados. sudo apt-get install software-properties-common sudo apt-add-repository ppa:brightbox/ruby-ng sudo apt update sudo apt install ruby2.3 ruby2.3-dev build-essential Continuamos con Erlang. wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add - # Cuidado con el siguiente paso, si no usas Ubuntu Bionic debes modificar por tu version echo "deb https://packages.erlang-solutions.com/ubuntu bionic contrib" | sudo tee /etc/apt/sources.list.d/erlang.list sudo apt-get update sudo apt-get install erlang Terminamos con la instalación de RabbitMQ. sudo sh -c 'echo "deb https://dl.bintray.com/rabbitmq/debian $(lsb_release -sc) main" >> /etc/apt/sources.list.d/rabbitmq.list' wget -O- https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc | sudo apt-key add - wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add - sudo apt update sudo apt install rabbitmq-server Iniciamos y habilitamos RabbitMQ. sudo systemctl enable rabbitmq-server sudo systemctl start rabbitmq-server Este paso es opcional, pero si quieres administrar RabbitMQ vía web también es posible con el siguiente comando. sudo rabbitmq-plugins enable rabbitmq_management Puedes acceder desde la siguiente url: http://dominio-o-ip:15672 El usuario y password de acceso es "guest", pero ojo... solo funciona si trabajas en local. Para concluir la configuración de RabbitMQ agregamos nuestro usuario (postal) y la pass. sudo rabbitmqctl add_vhost /postal sudo rabbitmqctl add_user postal tu-password sudo rabbitmqctl set_permissions -p /postal postal ".*" ".*" ".*"   Instalar Nodejs en Ubuntu Para un funcionamiento perfecto del servidor de correo, es recomendable instalar Nodejs. sudo apt install curl curl -sL https://deb.nodesource.com/setup_10.x | sudo bash sudo apt-get install nodejs   Instalar Postal Mail Server Por fin llegamos a los pasos finales, solo nos falta instalar y configurar el servidor Postal Mail Server. Creamos la cuenta del servicio y damos permiso a Ruby para que pueda escuchar. sudo useradd -r -m -d /opt/postal -s /bin/bash postal sudo setcap 'cap_net_bind_service=+ep' /usr/bin/ruby2.3 Necesitamos unos paquetes adicionales. sudo gem install bundler sudo gem install procodile sudo gem install nokogiri -v '1.7.2' Creamos el directorio principal de Postal Mail Server, descargamos la última versión, la extraemos y le damos acceso a nuestro usuario. sudo mkdir -p /opt/postal/app sudo wget https://postal.atech.media/packages/stable/latest.tgz sudo tar xvf latest.tgz -C /opt/postal/app sudo chown -R postal:postal /opt/postal sudo ln -s /opt/postal/app/bin/postal /usr/bin/postal Iniciamos los archivos de configuración. sudo postal bundle /opt/postal/vendor/bundle sudo postal initialize-config Vamos a editar el archivo de configuración con nuestros datos reales. sudo nano /opt/postal/config/postal.yml Asegurate de que los datos sean validos y que el dominio apunte al servidor o vps. web: # The host that the management interface will be available on host: postal.midominio.com # The protocol that requests to the management interface should happen on protocol: https fast_server: # This can be enabled to enable click & open tracking on emails. It is disabled by # default as it requires a separate static IP address on your server. enabled: false bind_address: general: # This can be changed to allow messages to be sent from multiple IP addresses use_ip_pools: false main_db: # Specify the connection details for your MySQL database host: 127.0.0.1 username: postaluser password: password base de datos database: postal message_db: # Specify the connection details for your MySQL server that will be house the # message databases for mail servers. host: 127.0.0.1 username: postaluser password: password base de datos prefix: postal rabbitmq: # Specify the connection details for your RabbitMQ server. host: 127.0.0.1 username: postal password: password de rabbitmq vhost: /postal dns: Guarda el archivo y cierra el editor. Ahora inicializamos el servicio y creamos una cuenta de usuario. sudo postal initialize sudo postal make-user Arrancamos postal y verificamos el status del servicio. sudo -u postal postal start sudo -u postal postal status ejemplo de salida... Procodile Version 1.0.26 Application Root /opt/postal/app Supervisor PID 18589 Started 2020-04-13 18:25:07 -0500 || web || Quantity 1 || Command bundle exec puma -C config/puma.rb || Respawning 5 every 3600 seconds || Restart mode usr1 || Log path none specified || Address/Port none || => web.1 Running 18:25 pid:18589 respawns:0 port:- tag:- Ya tenemos listo nuestro servidor Postal Mail Server, si quieres manejarlo a través de su portal gráfico necesitamos un servidor. Nosotros instalamos Nginx que es rápido y ligero.   Instalar Nginx La instalación de Nginx es fácil, tan solo debes seguir los pasos indicados. sudo apt install nginx sudo cp /opt/postal/app/resource/nginx.cfg /etc/nginx/sites-available/default Creamos un certificado SSL autofirmado. sudo mkdir /etc/nginx/ssl/ sudo openssl req -x509 -newkey rsa:4096 -keyout /etc/nginx/ssl/postal.key -out /etc/nginx/ssl/postal.cert -days 365 -nodes Introduce tus datos válidos. Generating a RSA private key ……………………………++++ …………++++ writing new private key to '/etc/nginx/ssl/postal.key' You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. Country Name (2 letter code) :ES State or Province Name (full name) :HU Locality Name (eg, city) :Monzon Organization Name (eg, company) : Organizational Unit Name (eg, section) : Common Name (e.g. server FQDN or YOUR name) :postal.midominio.com Email Address : Bien... para concluir editas el archivo de configuración de Nginx e insertas tu dominio. sudo nano /etc/nginx/sites-available/default ejemplo... server { listen :80; listen 0.0.0.0:80; server_name postal.midominio.com; return 301 https://$host$request_uri; } Reiniciamos el servidor Nginx. sudo systemctl reload nginx   Accedemos a Postal Mail Server Acceder al panel del servidor es tan simple como introducir el dominio que configuramos anteriormente. https://midominio.com https://panel.midominio.com
Tumblr media
Login Postal Media Server   Canales de Telegram: Canal SoloLinux – Canal SoloWordpress Espero que este articulo te sea de utilidad, puedes ayudarnos a mantener el servidor con una donación (paypal), o también colaborar con el simple gesto de compartir nuestros artículos en tu sitio web, blog, foro o redes sociales.   Read the full article
0 notes
the-openstack · 6 years ago
Photo
Tumblr media
How to Install and Upgrade Node.js v12.x, v13.x on Ubuntu 18.04 LTS ☞ http://bit.ly/2qeHjj5 #nodejs #javascript
0 notes
fullstackdevelop · 6 years ago
Photo
Tumblr media
How to Install and Upgrade Node.js v12.x, v13.x on Ubuntu 18.04 LTS ☞ http://bit.ly/35747jZ #nodejs #javascript
0 notes