CentOS 7にGraylogサーバーをインストールする方法
CentOS 7にGraylogサーバーをインストールし、ログ管理を行う方法を学びます。
Giteaは、gitを利用した代替オープンソースの自己ホスト型バージョン管理システムです。GiteaはGolangで記述されており、あらゆるプラットフォームでホストされる軽量のソリューションです。
Vultr Ubuntu 18.04サーバーインスタンスを更新します。
sudo apt update
Nginxをインストールします。
sudo apt -y install nginx
Nginxがインストールされたら、ブラウザーでnginxテストページを参照して、Nginxが機能しているかどうかをテストします。Webブラウザーを開いて、http://example.com
次のコマンドを使用して、停止、再読み込み、再起動、ステータスの確認、およびNginxの有効化を行うことができます。
sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl restart nginx.service
sudo systemctl reload nginx.service
sudo systemctl enable nginx.service
Gitをインストールします。
sudo apt -y install git
インストールしたら、バージョンを確認します。
git --version
git version 2.17.1
Giteaは以下のデータベースをサポートしています
このチュートリアルでは、MariaDBサーバーとクライアントをインストールします。
sudo apt -y install mariadb-server mariadb-client
MariaDBをインストールした後、以下のコマンドを使用して、停止、開始、再起動、ステータスの確認、有効化を行うことができます。
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl restart mariadb.service
sudo systemctl status mariadb.service
sudo systemctl enable mariadb.service
その後、以下のコマンドを実行して、rootパスワードを作成し、リモートrootアクセスを禁止することにより、MariaDBサーバーを保護します。
sudo mysql_secure_installation
プロンプトが表示されたら、ガイドに従って以下の質問に答えます。
Enter current password for root (enter for none): Just press the Enter
Set root password? [Y/n]: Y
New password: Enter password
Re-enter new password: Repeat password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y
MariaDBを再起動します。
sudo systemctl restart mariadb.service
MariaDBがインストールされているかどうかをテストするには、次のコマンドを入力してMariaDBサーバーにログオンします。
sudo mysql -u root -p
次に、上記で作成したパスワードを入力してログインします。MariaDBウェルカムメッセージが表示されます。
というデータベースを作成しますgitea
。
CREATE DATABASE gitea;
giteauser
新しいパスワードで呼び出されるデータベースユーザーを作成します。
CREATE USER 'giteauser'@'localhost' IDENTIFIED BY 'new_password_here';
次に、ユーザーにデータベースへのフルアクセスを許可します。
GRANT ALL ON gitea.* TO 'giteauser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;
最後に、変更を保存して終了します。
FLUSH PRIVILEGES;
EXIT;
Giteaを実行するユーザーを作成します。
sudo adduser \
--system \
--shell /bin/bash \
--gecos 'Git Version Control' \
--group \
--disabled-password \
--home /home/git \
git
必要なディレクトリ構造を作成します。
sudo mkdir -p /var/lib/gitea/{custom,data,indexers,public,log}
sudo chown git:git /var/lib/gitea/{data,indexers,log}
sudo chmod 750 /var/lib/gitea/{data,indexers,log}
sudo mkdir /etc/gitea
sudo chown root:git /etc/gitea
sudo chmod 770 /etc/gitea
Giteaバイナリは、次のコマンドを実行してダウンロードできます。
sudo wget -O gitea https://dl.gitea.io/gitea/1.5.0/gitea-1.5.0-linux-amd64
sudo chmod +x gitea
バイナリをグローバルな場所にコピーします。
sudo cp gitea /usr/local/bin/gitea
Linuxサービスファイルを作成します。
sudo nano /etc/systemd/system/gitea.service
ファイルに以下を入力します。
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
#After=mysqld.service
#After=postgresql.service
#After=memcached.service
#After=redis.service
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
# If you want to bind Gitea to a port below 1024 uncomment
# the two values below
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
起動時にGiteaを有効にして起動します。
sudo systemctl daemon-reload
sudo systemctl enable gitea
sudo systemctl start gitea
statusコマンドを実行します。
sudo systemctl status gitea
● gitea.service - Gitea (Git with a cup of tea)
Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: en
Active: active (running) since Wed 2018-10-10 14:15:28 CDT; 19ms ago
Main PID: 17769 (gitea)
Tasks: 4 (limit: 2321)
CGroup: /system.slice/gitea.service
├─17769 /usr/local/bin/gitea web -c /etc/gitea/app.ini
└─17774 /usr/local/bin/gitea web -c /etc/gitea/app.ini
デフォルトのnginx構成ファイルを削除します。
sudo rm /etc/nginx/sites-enabled/default
Giteaのリバースプロキシ構成を作成します。
sudo nano /etc/nginx/sites-available/git
ファイルに次の設定を入力します。
upstream gitea {
server 127.0.0.1:3000;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com;
root /var/lib/gitea/public;
access_log off;
error_log off;
location / {
try_files maintain.html $uri $uri/index.html @node;
}
location @node {
client_max_body_size 0;
proxy_pass http://localhost:3000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_max_temp_file_size 0;
proxy_redirect off;
proxy_read_timeout 120;
}
}
Gitea Nginxリバースプロキシ構成を有効にします。
sudo ln -s /etc/nginx/sites-available/git /etc/nginx/sites-enabled
次に、Nginxサービスをリロードします。
sudo systemctl reload nginx.service
次に、ブラウザーを開き、サーバーのホスト名またはIPアドレスを参照します。
http://example.com/install
画面の指示に従ってGiteaのセットアップを完了します。
CentOS 7にGraylogサーバーをインストールし、ログ管理を行う方法を学びます。
Debian 10にWebDAVをデプロイする方法を学び、WsgiDAVとSSL証明書で安全な接続を実現しましょう。
CentOS 7サーバーにApache 2.4をインストールする方法を説明します。安定したウェブサーバーを構築するための前提条件と手順を解説します。
FreeBSD 11.1におけるBlacklistdのインストール方法について詳しく解説します。この方法を通じて、強力なセキュリティ対策を実装できます。
サーバーマネージャーを使用して、Windows Serverの管理が向上します。セキュリティリスクを軽減し、効率的な管理を実現します。
CentOS 7にSeafileサーバーをインストールする方法。Seafile(コミュニティバージョン)は、ownCloudに似た無料のオープンソースファイル同期および共有ソリューションです。
Snortは無料のネットワーク侵入検知システムです。最新の方法で、SnortをDebianにインストールし、設定する手順を紹介します。ネットワークのセキュリティを強化しましょう。
CentOS 7にGraylogサーバーをインストールし、ログ管理を行う方法を学びます。
WindowsサーバーでWebサイトを実行している場合、電子メールも受信できるようにするためにhMailServerを使用する方法を解説します。
FiveMサーバーをUbuntu 19.04にインストールするための詳細なガイド。必要条件からインストール、起動、トラブルシューティングまで、すべてのステップを含みます。
Debian 10にWebDAVをデプロイする方法を学び、WsgiDAVとSSL証明書で安全な接続を実現しましょう。
ヘルスケアにおけるAIは、過去数十年から大きな飛躍を遂げました。したがって、ヘルスケアにおけるAIの未来は、日々成長を続けています。