サーバ設定

提供:kuhalaboWiki
(版間での差分)
移動: 案内, 検索
(Windows10)
 
(1人の利用者による、間の15版が非表示)
1行: 1行:
; CentOSインストール
+
== CentOS ==
  
; Apacheのインストール
+
;DNSレコード設定
 
<pre>
 
<pre>
yum -y install httpd
+
xxx.example.net A 3600 xxx.xxx.xxx.xxx
 
</pre>
 
</pre>
  
; iptablesの設定
+
iptablesの設定
* 設定確認
+
 
<pre>
 
<pre>
 +
設定確認
 
iptables -L
 
iptables -L
</pre>
+
 
* 設定
+
設定
<pre>
+
 
vi /etc/sysconfig//iptables
 
vi /etc/sysconfig//iptables
 
</pre>
 
</pre>
20行: 19行:
 
</pre>
 
</pre>
  
; php, php-mbstringインストール
+
;httpd, mysqld
 +
再起動しても起動時に自動的にサーバーが起動するように設定
 +
<pre>
 +
# systemctl enable httpd.service
 +
# systemctl enable mysqld.service
 +
</pre>
 +
サーバーを起動
 +
<pre>
 +
# systemctl start httpd.service
 +
# systemctl start mysqld.service
 +
</pre>
 +
 
 +
;Firewall
 +
Apache(http,https)のサービスを永続的に許可
 +
<pre>
 +
# firewall-cmd --zone=public --add-service=http --permanent
 +
# firewall-cmd --zone=public --add-service=https --permanent
 +
</pre>
 +
 
 +
firewalldを再起動する
 +
<pre>
 +
# firewall-cmd --reload
 +
</pre>
 +
 
 +
firewalldの起動&停止
 +
<pre>
 +
# systemctl start firewalld
 +
# systemctl stop firewalld
 +
 
 +
# firewall-cmd --get-default-zone
 +
public
 +
 
 +
firewall-cmd --list-all
 +
</pre>
 +
 
 +
== Apacheのインストール ==
 +
インストール
 +
<pre>
 +
# yum -y install httpd
 +
</pre>
 +
 
 +
バージョン確認
 +
<pre>
 +
# httpd -v
 +
</pre>
 +
 
 +
== php ==
 +
<pre>
 +
yum -y install php php-mysql
 +
php --version
 +
</pre>
 +
 
 
<pre>
 
<pre>
 
yum -y install php php-mbstring
 
yum -y install php php-mbstring
 
</pre>
 
</pre>
 +
 +
== httpd設定 ==
 +
*設定ファイル
 +
<pre>
 +
vi /etc/httpd/conf/httpd.conf
 +
</pre>
 +
*サーバ名指定
 +
<pre>
 +
ServerName www.example.net:80
 +
</pre>
 +
 +
== xemacsインストール ==
 +
<pre>
 +
yum -y install xemacs
 +
</pre>
 +
 +
; yumでアップデート
 +
<pre>
 +
yum update
 +
</pre>
 +
 +
== MySQL ==
 +
 +
MySQL のリポジトリの追加
 +
<pre>
 +
# yum -y install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
 +
</pre>
 +
 +
MySQL Community Server をインストール
 +
<pre>
 +
# yum -y install mysql-community-server
 +
</pre>
 +
 +
MySQL Server のバージョンを表示
 +
<pre>
 +
mysqld --version</pre>
 +
 +
firewalldの設定(CentOS7)
 +
<pre>
 +
#状態チェック
 +
firewall-cmd --list-services --zone=public  --permanent
 +
 +
#結果
 +
dhcpv6-client ftp http https ssh
 +
 +
#mysqlが無いので、追加
 +
firewall-cmd --add-service=mysql --zone=public --permanent
 +
 +
#もう一度チェック
 +
firewall-cmd --list-services --zone=public  --permanent
 +
 +
dhcpv6-client ftp http https mysql ssh
 +
 +
#リロードして有効に。
 +
firewall-cmd --reload
 +
</pre>
 +
 +
エクスポート
 +
<pre>
 +
$ mysqldump -u testuser -p testdb > export.sql
 +
</pre>
 +
 +
インポート
 +
<pre>
 +
$ mysql -u root -p
 +
> create database newdb;
 +
$ mysql -u root -p newdb < export.sql
 +
</pre>
 +
 +
 +
== Windows10 ==
 +
;時刻の同期のタイミング
 +
regeditでレジストリーを編集
 +
 +
<pre>
 +
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient
 +
</pre>
 +
 +
<pre>
 +
SpecialPollInterval
 +
</pre>
 +
 +
* 表記を「10進」にして、値のデータに「秒」を入力
 +
* 例えば1日にするなら「86400」を入力。(86400=60×60×24)
 +
* デフォルトは「604800(7日)」になっています。

2021年9月27日 (月) 09:28時点における最新版

目次

[編集] CentOS

DNSレコード設定
xxx.example.net A 3600 xxx.xxx.xxx.xxx

iptablesの設定

設定確認
iptables -L

設定
vi /etc/sysconfig//iptables
-A INPUT -p tcp --dport 80 -j ACCEPT
httpd, mysqld

再起動しても起動時に自動的にサーバーが起動するように設定

# systemctl enable httpd.service
# systemctl enable mysqld.service

サーバーを起動

# systemctl start httpd.service
# systemctl start mysqld.service
Firewall

Apache(http,https)のサービスを永続的に許可

# firewall-cmd --zone=public --add-service=http --permanent
# firewall-cmd --zone=public --add-service=https --permanent

firewalldを再起動する

# firewall-cmd --reload
firewalldの起動&停止
# systemctl start firewalld
# systemctl stop firewalld

# firewall-cmd --get-default-zone
public

firewall-cmd --list-all

[編集] Apacheのインストール

インストール

# yum -y install httpd

バージョン確認

# httpd -v

[編集] php

yum -y install php php-mysql
php --version
yum -y install php php-mbstring

[編集] httpd設定

  • 設定ファイル
vi /etc/httpd/conf/httpd.conf
  • サーバ名指定
ServerName www.example.net:80

[編集] xemacsインストール

yum -y install xemacs
yumでアップデート
yum update

[編集] MySQL

MySQL のリポジトリの追加

# yum -y install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

MySQL Community Server をインストール

# yum -y install mysql-community-server

MySQL Server のバージョンを表示

mysqld --version

firewalldの設定(CentOS7)

#状態チェック
firewall-cmd --list-services --zone=public  --permanent

#結果
dhcpv6-client ftp http https ssh

#mysqlが無いので、追加
firewall-cmd --add-service=mysql --zone=public --permanent

#もう一度チェック
firewall-cmd --list-services --zone=public  --permanent

dhcpv6-client ftp http https mysql ssh

#リロードして有効に。
firewall-cmd --reload

エクスポート

$ mysqldump -u testuser -p testdb > export.sql

インポート

$ mysql -u root -p
> create database newdb;
$ mysql -u root -p newdb < export.sql


[編集] Windows10

時刻の同期のタイミング

regeditでレジストリーを編集

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient
SpecialPollInterval
  • 表記を「10進」にして、値のデータに「秒」を入力
  • 例えば1日にするなら「86400」を入力。(86400=60×60×24)
  • デフォルトは「604800(7日)」になっています。
個人用ツール
名前空間

変種
操作
案内
ツールボックス