In this tutorial, we’ll walk you through the process of installing Fluentd using Ruby Gem on Ubuntu 22.04.
sudo apt-get update
sudo apt-get upgrade
Install Ruby Version Manager and Ruby
Install the Ruby Version Manager (RVM) to manage Ruby installations:
sudo apt-get install software-properties-common
sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt-get update
sudo apt-get install rvm -y
Add your user to the RVM group and reload your shell configuration:
sudo usermod -a -G rvm $USER
echo 'source "/etc/profile.d/rvm.sh"' >> ~/.bashrc
source ~/.bashrc
Before proceeding, restart your server to ensure all changes take effect.
Download and install the required OpenSSL library:
wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb
Now, install Ruby 2.7.6 and the necessary development headers:
rvm install 2.7.6
sudo apt install ruby-dev
Install Fluentd Gem
With Ruby installed, you can now install the Fluentd gem:
sudo gem install fluentd --no-doc
To verify that Fluentd has been installed successfully, run the following command:
sudo fluentd --setup ./fluent
You can now test your Fluentd installation by running it with your configuration file:
sudo fluentd -c ./fluent/fluent.conf -vv
Fluentd should start and display log messages indicating that it is running successfully. If you encounter any issues, review your configuration file and logs for errors.