Header Image - Cannyon is a clean WordPress theme

Monthly Archives

One Article

Ubuntu 16.04 – Nginx, PHP 7.2 + PHP-FPM, MariaDB, Redis i Elasticsearch

Nginx

apt install nginx

PHP7.2 + PHP-FPM

add-apt-repository ppa:ondrej/php
apt update
apt install php7.2 php7.2-cli php7.2-common php7.2-curl php7.2-fpm php7.2-gd php7.2-json php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml
php -v

MariaDB

apt install mariadb-server mariadb-clien
mysql_secure_installation
mysql –version

MySQL pitfalls

## Nakon instalacije i podešavanja root password-a moguće je passwordless login preko konzole ##
https://stackoverflow.com/questions/44298160/mysql-mariadb-10-0-29-set-root-password-but-still-can-login-without-asking-p/44301734

Problem prave pluginovi “‘console’ i ‘unix_socket'” koje treba disable-ovati, kroz MySQL konzolu.

Provera instaliranih pluginova iz mysql.user tabele

SELECT host, user, password, plugin FROM mysql.user LIMIT 0,1;

Disable spornih pluginova

SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘<Nova_sifra>’);
UPDATE mysql.user SET plugin = ” WHERE user = ‘root’ AND host = ‘localhost’;
FLUSH PRIVILEGES;

Instalacija Redis – Kompajliranje i instalacija iz source code

Redis je key-value NoSQL baza podaka koja se koristi kod keširanja.

apt install build-essential tcl
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
cd redis-stable/
make
make test
make install
mkdir /etc/redis
cp /tmp/redis-stable/redis.conf /etc/redis

Podešavanje glavne konfiguracije i PATH varijable

vim /etc/redis/redis.conf
<<
supervised systemd
dir /var/lib/redis

>

Kreiranje systemd fajla

vim /etc/systemd/system/redis.service
<<
[Unit]
Description=Redis In-Memory Data Store
After=network.target

[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always

[Install]
WantedBy=multi-user.target

>

Kreiranje novog Linux korisnika za Redis servis i podešavanje vlasništva i privilegija nad direktorijumom

adduser –system –group –no-create-home redis
mkdir /var/lib/redis
chown redis:redis /var/lib/redis
chmod 770 /var/lib/redis
systemctl start redis
systemctl status redis
systemctl enable redis

Testiranje Redis iz konzole

redis-cli
ping

Provera verzije Redis servera

redis-server –version

Instalacija JAVA JDK 1.8 (MINIMALNA VERZIJA ZA ELASTICSEARCH JE 1.8.0_131)

apt install default-jdk
java -version

Videti putanju gde je Java instalirana

update-alternatives (Linux komanda kojom se podešavaju simbolički linkovi kod sistemskih komandi)

update-alternatives –config java

PODESITI $JAVA_HOME VARIJABLU I UBACITI PUTANJU NA KRAJ

vim /etc/environment
<<
JAVA_HOME=”/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java”

>

source /etc/environment
echo $JAVA_HOME

Instalacija Elasticsearch

https://tecadmin.net/setup-elasticsearch-on-ubuntu/
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsearch-on-ubuntu-16-04

Elasticsearch je open-soruce server pisani u Javi, koristi se kao full-text search engine sa HTTP web interfejsom koji je optimizovan za tekstualnu pretragu. Kominikacija sa Elasticsearch se obavlja preko RESTfull API i moguće koristiti HTTP zahteve u toj komunikaciji.

apt install apt-transport-https
wget -qO – https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add –
add-apt-repository “deb https://artifacts.elastic.co/packages/6.x/apt stable main”
apt update
apt install elasticsearch

vim /etc/elasticsearch/elasticsearch.yml
<<<
cluster.name: vivo_elasticsearch
node.name: node-1
path.data: /var/lib/elasticsearch
network.host: “0.0.0.0”

>

systemctl start elasticsearch
systemctl status elasticsearch
netstat -tlpn

Testianje Elasticsearch

curl -X GET http://192.168.10.100:9200

Provera verzije Elasticsearch kroz konzolu

curl -XGET ‘localhost:9200’