Installation influxdb on Ubuntu
InfluxDB can be
installed by directly querying the official repositories of this tool. First,
add them to your list, by typing the following commands:
sudo
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
sudo
echo "deb https://repos.influxdata.com/ubuntu
bionic stable" | sudo tee
/etc/apt/sources.list.d/influxdb.list
sudo
echo "deb https://repos.influxdata.com/ubuntu
bionic stable" | sudo tee
/etc/apt/sources.list.d/influxdb.list
sudo
apt update
Once the list of repositories has been updated, proceed with the
installation of InfluxDB using the command:
sudo apt install influxdb
Once installed, check the status of the service via:
sudo systemctl status influxdb
Error detail info:
sudo apt update
Ign:1 http://archive.canonical.com/ubuntu bionic InRelease
Err:2 http://archive.canonical.com/ubuntu bionic Release
404 Not Found [IP: 91.189.92.191 80]
Ign:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Ign:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Ign:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Ign:6 http://archive.ubuntu.com/ubuntu bionic-security InRelease
Err:7 http://archive.ubuntu.com/ubuntu bionic Release
404 Not Found [IP: 91.189.88.174 80]
Err:8 http://archive.ubuntu.com/ubuntu bionic-updates Release
404 Not Found [IP: 91.189.88.174 80]
Err:9 http://archive.ubuntu.com/ubuntu bionic-backports Release
404 Not Found [IP: 91.189.88.174 80]
Err:10 http://archive.ubuntu.com/ubuntu bionic-security Release
404 Not Found [IP: 91.189.88.174 80]
Reading package lists... Done
E: The repository 'http://archive.canonical.com/ubuntu bionic Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-security Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Solutions:
· For some
reason APT can not find the Release
file in the specified repositories
list.
To fix
this, I would suggest the following:
·
Check if your connection to the Internet is
behind a firewall, limited in any way or behind a proxy and configure your
system and connection accordingly or change to a different connection if
available.
·
Check if there is an APT proxy configuration
file by running the following command:
ls /etc/apt/apt.conf.d/*proxy*
If the
command returns back any results, move these files out of the /etc/apt/apt.conf.d/
directory
or delete them.
- Revert your repositories list to the original
Ubuntu Bionic Beaver list by running the following command in the
terminal:
sudo nano /etc/apt/sources.list
A file
editor will be opened. Delete all the lines in it and then copy and paste the
following in the file editor:
deb http://archive.ubuntu.com/ubuntu bionic main universe multiverse restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe restricted
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse universe restricted
Then, save
and close the file by pressing Ctrl + X then
press Y then
press Enter
To verify
you saved the file correctly, please run the following command in the terminal:
cat /etc/apt/sources.list
The output
should be exactly:
deb http://archive.ubuntu.com/ubuntu bionic main universe multiverse restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe restricted
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse universe restricted
Ubuntu
repositories have a defined format. They should be for example something like deb http://archive.ubuntu.com/ubuntu
bionic main
.
Explanation:
deb: These
repositories contain binaries or precompiled packages. These repositories are
required for most users.
http://archive.ubuntu.com/ubuntu: The URI
(Uniform Resource Identifier), in this case a location on the internet.
bionic: is the
release name of your Ubuntu installation.
main & restricted ...etc: are the
section names or components. There can be several section names, separated by
spaces.
After that, please update your repositories list by running the
following command in the terminal:
sudo apt update
You should now be able to install packages and update your system again.
Notice:
If you still get errors, please first back up /etc/apt/sources.list.d/ to your home
directory by running the following command in the terminal:
mkdir ~/old_sources_list_d &&
sudo cp -r /etc/apt/sources.list.d/* ~/old_sources_list_d/
After that, please clear all existing PPAs and repository lists in /etc/apt/sources.list.d/ by running
the following command in the terminal:
sudo rm -r /etc/apt/sources.list.d/*
Then, please update your repositories list by running the following
command again in the terminal:
sudo apt update
$ sudo chmod +x
/usr/lib/influxdb/scripts/influxd-systemd-start.sh
Useful commands:
To add portal in repository as see below
$ sudo add-apt-repository 'deb [arch=amd64]
https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse'
The repository will be appended
to sources.list file.
You can now install an y of the
packages from the newly enabled repository:
$ sudo apt install mongodb-org
If for any reasons you want to remove a previously enabled repository,
use the --remove option:
$ sudo add-apt-repository --remove
'deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0
multiverse'
To add repository manually
If you want to have more control over how your
sources are organized you can manually edit the /etc/apt/sources.list file and
add the apt repository line to the file.
For demonstration, we will enable
the CouchDB repository and install the software. CouchDB is a free and
open-source fault-tolerant NoSQL database maintained by the Apache Software
Foundation.
To add the repository open the
sources.list file with your text editor :
$ sudo nano /etc/apt/sources.list
Add the repository line to the end of
the file:
/etc/apt/sources.list
deb
https://apache.bintray.com/couchdb-deb bionic main
Another option is to create a
new the repository file under the /etc/apt/sources.list.d/
directory.
When manually configuring a repository you also need to manually
import the public repository key to your system. To do that use either wget
or curl
:
curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | sudo apt-key add -
The command above should output OK
which
means that the GPG key has been successfully imported and packages from this
repository will be considered trusted.
Before installing the packages from the newly added repository
you must update the package index:
sudo apt update
Once the package index is updated you can install packages from
the newly added repository:
sudo apt install couchdb
To remove swap file
$ rm .MERGE_MSG.swp
To remove mal function file
$ sudo rm
/etc/apt/sources.list.d/file.list
To vi editor
Command Purpose
i
Switch to Insert mode.
Esc Switch to Command mode.
:w
Save and continue editing.
:wq or ZZ Save
and quit/exit vi.
To edit file on Nano editor and save
$ sudo nano /etc/apt/sources.list
Add file/modify file Then, save and close the file by pressing Ctrl + X then
press Y then
press Enter
To edit file on vi editor and save
$ sudo vi /etc/apt/files.list
Type a colon (:) to move the cursor to the bottom of the screen.
7 Type wq.
(i.e) $ :wq
Commands:
Installation
InfluxDB can be installed by directly querying the official
repositories of this tool. First, add them to your list, by typing the
following commands:
sudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
sudo echo " deb
http://archive.ubuntu.com/ubuntu bionic main universe multiverse restricted" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo echo " deb
http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe
restricted" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo echo " deb
http://archive.ubuntu.com/ubuntu bionic-updates main multiverse universe
restricted" | sudo tee /etc/apt/sources.list.d/influxdb.list
(or)
- Revert
your repositories list to the original Ubuntu Bionic Beaver list by
running the following command in the terminal:
sudo nano /etc/apt/sources.list
A file editor will be opened. Delete all the lines in it and then copy
and paste the following in the file editor:
deb http://archive.ubuntu.com/ubuntu
bionic main universe multiverse restricted
deb
http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe
restricted
deb http://archive.ubuntu.com/ubuntu
bionic-updates main multiverse universe restricted
Then, save and close the file by pressing Ctrl + X then
press Y then
press Enter
To verify you saved the file correctly, please run the following command
in the terminal:
cat /etc/apt/sources.list
The output should be exactly:
deb http://archive.ubuntu.com/ubuntu bionic main universe multiverse restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe restricted
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse universe restricted
sudo apt update
Once the list of repositories has been updated, proceed with the
installation of InfluxDB using the command:
sudo apt install influxdb
Once installed, check the status of the service via:
sudo systemctl status influxdb
If, when typing this command, a result similar to the one shown
in the screenshot above appears, the tool has been correctly installed, but is
not running yet.
To start it and make sure that the service is always available
every time the machine is restarted, type the command:
sudo systemctl
enable --now influxdb
In this way, not only will it start on the spot, but it will be
reloaded every time the server is restarted. To start it manually, run, as an
alternative to the command shown above, the following:
sudo systemctl start influxdb
To stop the execution of InfluxDB use the command:
sudo systemctl stop influxdb
Configuring
InfluxDB
The InfluxDB configuration file is located by default in the /etc/influxdb/influxdb.conf folder.
Many features are commented out. To enable them, simply open the
configuration file and delete the "#" symbols from the relevant line.
To modify the configuration file use the command:
sudo nano /etc/influxdb/influxdb.conf
For example, to access via HTTP request (enabling endpoints),
uncomment the "enabled" item in the "http" section, as
shown in the following screenshot:
When the necessary changes are made, close and exit using the
key combination CTRL + X / Y / Enter.
To apply the changes, the service has to be restarted. This
operation that can be carried out using the commands described above:
sudo systemctl stop influxdb && sudo systemctl start influxdb
As with any database, after the installation the first thing to do
is to create an administrator account. This can be done using the following
command:
curl -XPOST
"http://localhost:8086/query" --data-urlencode
"q=CREATE USER admin WITH PASSWORD 'password' WITH ALL PRIVILEGES"
Clearly replace:
- admin: with the user name;
- password: with the password for the
database login.
Once the account is created, access the InfluxDB shell by using
the command:
influx -username
'admin' -password
'password'
N.B. also in this case, the “admin” and “password” parameters
have to be replaced with those previously declared.
In addition to
running queries directly from the shell, your queries can be submitted to
InfluxDB by using
tools such as "curl". The syntax to respect is the following:
curl
-G http://localhost:8086/query -u ADMIN_NAME:PASSWORD_NAME --data-urlencode "q=QUERY"
Again, replace:
- "ADMIN_NAME"
with the name of the user created;
- "PASSWORD_NAME"
with the password associated with that user;
- “QUERY”
with the query to be executed.
For example, to
access with the data used in this tutorial and view all the databases present,
the command to execute would be:
curl
-G http://localhost:8086/query -u admin:password --data-urlencode "q=SHOW DATABASES"
N.B. If the
InfluxDB database is queried from a machine other than the one where the server
is installed, instead of ‘localhost’, enter the IP address of the machine to
query.
Enabling
the Firewall
Since InfluxDB can also be queried from the outside, it may be
necessary to update the firewall rules to allow it to connect.
If your firewall is UFW just
type the following commands:
sudo ufw allow 8086/tcp
This will allow TCP traffic on port 8086 used by InfluxDB for
querying the database from outside.
Useful links:
Install influx on ubuntu
1)https://www.arubacloud.com/tutorial/how-to-install-influxdb-on-ubuntu-20-04.aspx
Fix issue
permission denied issue
Add repository on Ubuntu source
list
Beginners commands
5) https://techlog360.com/basic-ubuntu-commands-terminal-shortcuts-linux-beginner/
How do I remove a malformed line
from my sources.list?
6) https://www.youtube.com/watch?v=X0FApmuZw98
$ sudo rm /etc/apt/sources.list.d/file.list
useful commands and links
1)Display the current Ubuntu hostname
$ hostname
2)To know the which ubuntu version installed
$ lsb_release -a
Note:
LSB (Linux Standard Base)information about your specific Linux distribution, including version number, release codename, and distributor ID.
3) Install net tools if not available
$ Install net tools
sudo apt install net-tools
4)$ netstat -n -l
5) cat /lib/systemd/system/influxdb.service
6)usermod -aG sudo username
To give permission to file
sudo chmod +x /usr/lib/influxdb/scripts/influxd-systemd-start.sh
To add repository via command line and remove file in repository
sudo add-apt-repository 'deb [arch=amd64] http://archive.ubuntu.com /ubuntu focal InRelease'
sudo add-apt-repository --remove 'deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse'
sudo service influxdb start
sudo systemctl enable --now influxdb
sudo systemctl status influxdb
To vi editor
Command Purpose
i Switch to Insert mode.
Esc Switch to Command mode.
:w Save and continue editing.
:wq or ZZ Save and quit/exit vi.
To remove swap file
rm .MERGE_MSG.swp
To remove mal function file
sudo rm /etc/apt/sources.list.d/file.list
$ sudo nano /etc/apt/sources.list
cat /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu bionic main universe multiverse restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe restricted
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse universe restricted
Ctrl + X then press Y then press Enter
Linux links
https://www.cyberciti.biz/faq/ubuntu-change-hostname-command/
https://techlog360.com/basic-ubuntu-commands-terminal-shortcuts-linux-beginner/
https://www.howtogeek.com/50787/add-a-user-to-a-group-or-second-group-on-linux/
https://docs.influxdata.com/influxdb/v1.8/introduction/install/
https://www.arubacloud.com/tutorial/how-to-install-influxdb-on-ubuntu-20-04.aspx
https://linuxize.com/post/how-to-add-user-to-sudoers-in-ubuntu/
http://old-releases.ubuntu.com/releases/focal/
https://repos.influxdata.com/ubuntu/dists/focal/stable/binary-amd64/Packages
https://www.influxdata.com/blog/influxdb-shards-retention-policies/
https://www.codegrepper.com/code-examples/shell/grant+all+the+permission+to+the+user+ubuntu
https://linuxize.com/post/how-to-add-apt-repository-in-ubuntu/#:~:text=Adding%20Repositories%20with%20add%2Dapt%2Drepository,-The%20basic%20syntax&text=list%20file%20like%20deb%20http,apt%2Drepository%20in%20your%20terminal.
https://itectec.com/ubuntu/ubuntu-unable-to-update-or-install-anything-after-moving-to-another-country/
http://old-releases.ubuntu.com/releases/focal/ubuntu-20.04-desktop-amd64.iso
https://www.dummies.com/web-design-development/web-hosting/how-to-edit-files-with-vi/
https://www.sqlshack.com/a-comprehensive-guide-to-sql-server-always-on-availability-groups-on-windows-server-2016/
ReplyDelete