Sabtu, 07 Juli 2018

Install pyTelegramBotAPI on Linux machine

  Tidak ada komentar
Some time as sysadmin we need to setup the host to login using ssh without typing password
Step 1: Install Requirement environment
First we need install epel release before we can install pip
[maswachid@ccontrol90 ~]$ sudo yum install epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.nes.co.id
 * extras: repo.apiknet.co.id
 * updates: repo.apiknet.co.id
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution
.....         
 Install pip by running following command
[maswachid@ccontrol90 ~]$ sudo yum install -y python-pip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
....
Install BeautifulSoap plugin with pip by running following command 
[maswachid@ccontrol90 ~]$
[maswachid@ccontrol90 ~]$ sudo pip install BeautifulSoup4
Collecting BeautifulSoup4
  Downloading https://files.pythonhosted.org/packages/a6/29/bcbd41a916ad3faf517780a0af7d0254e8d6722ff6414723eedba4334531/beautifulsoup4-4.6.0-py2-none-any.whl (86kB)
    100% |████████████████████████████████| 92kB 1.1MB/s
Installing collected packages: BeautifulSoup4
Successfully installed BeautifulSoup4-4.6.0
Step 2: Install pyTelegramBotAPI
Install the telegram bot api using pip by running following command 
[maswachid@ccontrol90 ~]$
[maswachid@ccontrol90 ~]$ sudo pip install pyTelegramBotAPI
Collecting pyTelegramBotAPI
  Downloading https://files.pythonhosted.org/packages/9e/7c/fcc6beb6f3f4030714ced7ac640c1b1158ea03ae674c87d925d6e07152be/pyTelegramBotAPI-3.6.3.tar.gz (53kB)
    100% |████████████████████████████████| 61kB 1.4MB/s
Collecting requests (from pyTelegramBotAPI)
  Downloading https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (91kB)
    100% |████████████████████████████████| 92kB 2.2MB/s
Collecting six (from pyTelegramBotAPI)
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting idna<2.8,>=2.5 (from requests->pyTelegramBotAPI)
  Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
    100% |████████████████████████████████| 61kB 2.4MB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests->pyTelegramBotAPI)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 2.6MB/s
Collecting urllib3<1.24,>=1.21.1 (from requests->pyTelegramBotAPI)
  Downloading https://files.pythonhosted.org/packages/bd/c9/6fdd990019071a4a32a5e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 1.6MB/s
Collecting certifi>=2017.4.17 (from requests->pyTelegramBotAPI)
  Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
    100% |████████████████████████████████| 153kB 1.3MB/s
Installing collected packages: idna, chardet, urllib3, certifi, requests, six, pyTelegramBotAPI
  Running setup.py install for pyTelegramBotAPI ... done
Successfully installed certifi-2018.4.16 chardet-3.0.4 idna-2.7 pyTelegramBotAPI-3.6.3 requests-2.19.1 six-1.11.0 urllib3-1.23
You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[maswachid@ccontrol90 ~]$
Create file for telegram bot command and config
[maswachid@ccontrol90 ~]$ vi TelegramBot.py
[maswachid@ccontrol90 ~]$ vi config.py
[maswachid@ccontrol90 ~]$
[maswachid@ccontrol90 ~]$ ls
config.py  TelegramBot.py
[maswachid@ccontrol90 ~]$
[maswachid@ccontrol90 ~]$ chmod 755 TelegramBot.py config.py
[maswachid@ccontrol90 ~]$ ls
config.py  s9s_tmp  TelegramBot.py
[maswachid@ccontrol90 ~]$
[maswachid@ccontrol90 ~]$ phyton TelegramBot.py

Tidak ada komentar :

Posting Komentar