[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 character-set-server = utf8 skip-name-resolve skip-innodb default-storage-engine=MyISAM interactive_timeout = 50 join_buffer = 1M key_buffer = 250M max_connections = 100 max_heap_table_size = 32M myisam_sort_buffer_size = 96M query_cache_limit = 4M query_cache_size = 250M query_prealloc_size = 65K query_alloc_block_size = 128K read_buffer_size = 1M read_rnd_buffer_size = 768K sort_buffer_size = 1M table_cache = 4096 thread_cache_size = 1024 tmp_table_size = 32M wait_timeout = 500 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [mysql] default-character-set = utf8 [isamchk] key_buffer = 64M sort_buffer = 64M read_buffer = 16M write_buffer = 16M [myisamchk] key_buffer = 64M sort_buffer = 64M read_buffer = 16M write_buffer = 16M
2012年12月24日月曜日
VPS 2GB用のmy.cnf
お名前.com VPSの2GBプラン用のmy.cnfファイルです。
お名前.com VPSにSL6.3をインストールした時のメモ
cat /etc/redhat-release Scientific Linux release 6.3 (Carbon)
ID関連
一般ユーザーを作って、sshを使ったrootログインを制限して、suできるユーザーを限定する。useradd hoge passwd hoge usermod -G wheel hoge
vi /etc/ssh/sshd_config
Port 2022 Protocol 2 SyslogFacility AUTHPRIV PermitRootLogin no PasswordAuthentication yes PermitEmptyPasswords no ChallengeResponseAuthentication no UsePAM yes Subsystem sftp /usr/libexec/openssh/sftp-server
service sshd restart
vi /etc/pam.d/su
#%PAM-1.0 auth sufficient pam_rootok.so # Uncomment the following line to implicitly trust users in the "wheel" group. #auth sufficient pam_wheel.so trust use_uid # Uncomment the following line to require a user to be in the "wheel" group. auth required pam_wheel.so use_uid auth include system-auth account sufficient pam_succeed_if.so uid = 0 use_uid quiet account include system-auth password include system-auth session include system-auth session optional pam_xauth.soついでにロケールを変更。
vi /etc/sysconfig/i18n
LANG="ja_JP.UTF-8" SYSFONT="latarcyrheb-sun16"
IPv6関連
IPv6が有効になっているかを確認。
ifconfig -a
eth0 Link encap:Ethernet HWaddr 52:54:01:00:62:10
inet addr:49.212.122.248 Bcast:49.212.123.255 Mask:255.255.254.0
inet6 addr: fe80::5054:1ff:fe00:6210/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
IPv6を無効にする。
echo 'options ipv6 disable=1' >/etc/modprobe.d/disable-ipv6.conf chkconfig ip6tables off reboot
APIPA関連
APIPAが有効になっているかを確認する。netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 49.212.122.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 49.212.122.1 0.0.0.0 UG 0 0 0 eth0netowkを編集して無効にする。
vi /etc/sysconfig/network
NETWORKING=yes HOSTNAME=v103-3-18-170.myvps.jp GATEWAY=49.212.122.1 NOZEROCONF=yes
service network restart
yumリポジトリ関連
yumのプラグインを追加。yum install yum-plugin-fastestmirror yum-plugin-prioritiessl.repoとsl-other.repoのプライオリティを1に設定し最優先にする。
cd /etc/yum.repos.d vi sl.repoそれぞれのセクションの最後に以下の行を追加
priority=1EPELをリポジトリに追加する。
yum install epel-releaseIUS Yumリポジトリを追加する
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/ius-release-1.0-10.ius.el6.noarch.rpm rpm -Uvh ius-release-1.0-8.ius.el6.noarch.rpmRPMforgeを追加する。
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm全てのパッケージをアップデートしておきます。
yum update
iptables
iptablesを一括設定するファイルを作成しておきます。 ここでは、sshd, http, smtpを開けておきます。#!/bin/sh /sbin/iptables -F /sbin/iptables -X /sbin/iptables -P INPUT DROP /sbin/iptables -P OUTPUT ACCEPT /sbin/iptables -P FORWARD DROP /sbin/iptables -A INPUT -i lo -j ACCEPT /sbin/iptables -A OUTPUT -o lo -j ACCEPT /sbin/iptables -A INPUT -s 10.0.0.0/8 -j DROP /sbin/iptables -A INPUT -s 172.16.0.0/12 -j DROP /sbin/iptables -A INPUT -s 192.168.0.0/16 -j DROP /sbin/iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT /sbin/iptables -A INPUT -p tcp --dport 2022 -j ACCEPT /sbin/iptables -A INPUT -p tcp --dport 25 -j ACCEPT /sbin/iptables -A INPUT -p tcp --dport 80 -j ACCEPT /sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT /etc/rc.d/init.d/iptables save
2012年9月22日土曜日
PDFファイルをEvernoteに保存する
PDFファイルをDropboxに保存すると、自動的にEvernoteに連携される仕組みを作ってみました。
WappwolfのDropbox Automatorというサービスを使います。既にDropboxとEvernoteはアカウントを持っていますので、Wappwolfのアカウントを作るところからです。
Try now! をクリックして、Login with dropbox "one folder" accessを選びます。
Dropboxにサインインして、Wappwolf Automator からの接続リクエストを許可します。 DropboxにWappwolfフォルダが作成され、その下に自動化するためのフォルダを指定する画面になりますので、適当な名前を入力します。
次に画面をスクロールして、Any fileにある Upload it to Evernoteを選択して、Connect to Evernoteをクリックします。
Evernoteにサインインして、Wappwolfのアクセスを承認します。 画面が戻ったら上に表示されている、Finishedをクリックします。 次の画面が表示されたら完了のようです。うまく行かなかった場合には、もう一回やってみるといいかもしれません。
これで準備完了です。 EvernoteにアップロードしたいファイルをDropboxの¥Apps¥Wappwolf¥Evernoteに保存すればOKです。
Dropboxにサインインして、Wappwolf Automator からの接続リクエストを許可します。 DropboxにWappwolfフォルダが作成され、その下に自動化するためのフォルダを指定する画面になりますので、適当な名前を入力します。
次に画面をスクロールして、Any fileにある Upload it to Evernoteを選択して、Connect to Evernoteをクリックします。
Evernoteにサインインして、Wappwolfのアクセスを承認します。 画面が戻ったら上に表示されている、Finishedをクリックします。 次の画面が表示されたら完了のようです。うまく行かなかった場合には、もう一回やってみるといいかもしれません。
これで準備完了です。 EvernoteにアップロードしたいファイルをDropboxの¥Apps¥Wappwolf¥Evernoteに保存すればOKです。
2012年8月5日日曜日
install php5 on OpenSUSE 12
# zypper install php5 php5-mysql php5-mbstring php5-gd php5-fpm Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW packages are going to be installed: libsqlite3-0 php5 php5-ctype php5-dom php5-fpm php5-gd php5-iconv php5-json php5-mbstring php5-mysql php5-pdo php5-sqlite php5-tokenizer php5-xmlreader php5-xmlwriter sqlite2 t1lib The following recommended packages were automatically selected: php5-ctype php5-dom php5-iconv php5-json php5-sqlite php5-tokenizer php5-xmlreader php5-xmlwriter The following packages are suggested, but will not be installed: php5-gettext php5-pear php5-suhosin 17 new packages to install. Overall download size: 3.6 MiB. After the operation, additional 13.6 MiB will be used. Continue? [y/n/?] (y): y Retrieving package t1lib-5.1.2-15.7.1.x86_64 (1/17), 152.0 KiB (405.0 KiB unpacked) Retrieving: t1lib-5.1.2-15.7.1.x86_64.rpm [done] Retrieving package php5-5.3.8-4.24.1.x86_64 (2/17), 1.1 MiB (4.6 MiB unpacked) Retrieving: php5-5.3.8-4.24.1.x86_64.rpm [done (7.1 MiB/s)] Retrieving package php5-xmlwriter-5.3.8-4.24.1.x86_64 (3/17), 29.0 KiB (47.0 KiB unpacked) Retrieving: php5-xmlwriter-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-tokenizer-5.3.8-4.24.1.x86_64 (4/17), 24.0 KiB (19.0 KiB unpacked) Retrieving: php5-tokenizer-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-pdo-5.3.8-4.24.1.x86_64 (5/17), 54.0 KiB (120.0 KiB unpacked) Retrieving: php5-pdo-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-mbstring-5.3.8-4.24.1.x86_64 (6/17), 402.0 KiB (2.1 MiB unpacked) Retrieving: php5-mbstring-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-json-5.3.8-4.24.1.x86_64 (7/17), 31.0 KiB (35.0 KiB unpacked) Retrieving: php5-json-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-iconv-5.3.8-4.24.1.x86_64 (8/17), 33.0 KiB (39.0 KiB unpacked) Retrieving: php5-iconv-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-gd-5.3.8-4.24.1.x86_64 (9/17), 100.0 KiB (333.0 KiB unpacked) Retrieving: php5-gd-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-fpm-5.3.8-4.24.1.x86_64 (10/17), 1.0 MiB (4.2 MiB unpacked) Retrieving: php5-fpm-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-dom-5.3.8-4.24.1.x86_64 (11/17), 64.0 KiB (173.0 KiB unpacked) Retrieving: php5-dom-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-ctype-5.3.8-4.24.1.x86_64 (12/17), 23.0 KiB (15.0 KiB unpacked) Retrieving: php5-ctype-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-mysql-5.3.8-4.24.1.x86_64 (13/17), 69.0 KiB (200.0 KiB unpacked) Retrieving: php5-mysql-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package php5-xmlreader-5.3.8-4.24.1.x86_64 (14/17), 29.0 KiB (31.0 KiB unpacked) Retrieving: php5-xmlreader-5.3.8-4.24.1.x86_64.rpm [done] Retrieving package libsqlite3-0-3.7.8-1.1.2.x86_64 (15/17), 262.0 KiB (798.0 KiB unpacked) Retrieving: libsqlite3-0-3.7.8-1.1.2.x86_64.rpm [done] Retrieving package sqlite2-2.8.17-179.1.2.x86_64 (16/17), 148.0 KiB (346.0 KiB unpacked) Retrieving: sqlite2-2.8.17-179.1.2.x86_64.rpm [done] Retrieving package php5-sqlite-5.3.8-4.24.1.x86_64 (17/17), 62.0 KiB (160.0 KiB unpacked) Retrieving: php5-sqlite-5.3.8-4.24.1.x86_64.rpm [done (0 B/s)] Installing: t1lib-5.1.2-15.7.1 [done] Installing: php5-5.3.8-4.24.1 [done] Installing: php5-xmlwriter-5.3.8-4.24.1 [done] Installing: php5-tokenizer-5.3.8-4.24.1 [done] Installing: php5-pdo-5.3.8-4.24.1 [done] Installing: php5-mbstring-5.3.8-4.24.1 [done] Installing: php5-json-5.3.8-4.24.1 [done] Installing: php5-iconv-5.3.8-4.24.1 [done] Installing: php5-gd-5.3.8-4.24.1 [done] Installing: php5-fpm-5.3.8-4.24.1 [done] Installing: php5-dom-5.3.8-4.24.1 [done] Installing: php5-ctype-5.3.8-4.24.1 [done] Installing: php5-mysql-5.3.8-4.24.1 [done] Installing: php5-xmlreader-5.3.8-4.24.1 [done] Installing: libsqlite3-0-3.7.8-1.1.2 [done] Installing: sqlite2-2.8.17-179.1.2 [done] Installing: php5-sqlite-5.3.8-4.24.1 [done]
# chkconfig php-fpm onphpの内容を確認します。
# cd /srv/www/htdocs # echo '<?php phpinfo(); ?>' >info.php
2012年8月4日土曜日
install nginx on OpenSUSE 12
# zypper install nginx Loading repository data... Reading installed packages... 'nginx' not found in package names. Trying capabilities. Resolving package dependencies... The following NEW packages are going to be installed: GeoIP libGeoIP1 libxslt1 nginx-1.0 The following recommended package was automatically selected: GeoIP 4 new packages to install. Overall download size: 1.3 MiB. After the operation, additional 4.0 MiB will be used. Continue? [y/n/?] (y): y Retrieving package libxslt1-1.1.26-15.8.1.x86_64 (1/4), 149.0 KiB (402.0 KiB unpacked) Retrieving: libxslt1-1.1.26-15.8.1.x86_64.rpm [done (6.2 KiB/s)] Retrieving package libGeoIP1-1.4.7-3.1.2.x86_64 (2/4), 75.0 KiB (242.0 KiB unpacked) Retrieving: libGeoIP1-1.4.7-3.1.2.x86_64.rpm [done] Retrieving package GeoIP-1.4.7-3.1.2.x86_64 (3/4), 481.0 KiB (1.2 MiB unpacked) Retrieving: GeoIP-1.4.7-3.1.2.x86_64.rpm [done] Retrieving package nginx-1.0-1.0.10-3.4.1.x86_64 (4/4), 581.0 KiB (2.1 MiB unpacked) Retrieving: nginx-1.0-1.0.10-3.4.1.x86_64.rpm [done] Installing: libxslt1-1.1.26-15.8.1 [done] Installing: libGeoIP1-1.4.7-3.1.2 [done] Installing: GeoIP-1.4.7-3.1.2 [done] Installing: nginx-1.0-1.0.10-3.4.1 [done] # chkconfig nginx on # rcnginx startSuSEfirewall2を設定して、ポート80へのInboundを許可します。
# cd /etc/sysconfig/SuSEfirewall2.d/services # echo 'TCP="80"' >httpd
# vi /etc/sysconfig/SuSEfirewall2 FW_CONFIGURATIONS_EXT="sshd smtp dovecot httpd"設定を反映します。
# rcSuSEfirewall2 restart
Install MySQL on OpenSUSE 12
パッケージをインストールします。
# zypper install mysql-community-server mysql-community-client Loading repository data... Reading installed packages... 'mysql-community-client' not found in package names. Trying capabilities. No provider of 'mysql-community-client' found. Resolving package dependencies... The following NEW packages are going to be installed: mysql-community-server mysql-community-server-client mysql-community-server-errormessages 3 new packages to install. Overall download size: 8.0 MiB. After the operation, additional 60.5 MiB will be used. Continue? [y/n/?] (y): y Retrieving package mysql-community-server-errormessages-5.5.25-3.12.1.x86_64 (1/3), 146.0 KiB (1.0 MiB unpacked) Retrieving: mysql-community-server-errormessages-5.5.25-3.12.1.x86_64.rpm [done]Retrieving package mysql-community-server-client-5.5.25-3.12.1.x86_64 (2/3), 736.0 KiB (17.1 MiB unpacked) Retrieving: mysql-community-server-client-5.5.25-3.12.1.x86_64.rpm [done]Retrieving package mysql-community-server-5.5.25-3.12.1.x86_64 (3/3), 7.1 MiB (42.4 MiB unpacked) Retrieving: mysql-community-server-5.5.25-3.12.1.x86_64.rpm [done] Installing: mysql-community-server-errormessages-5.5.25-3.12.1 [done] Installing: mysql-community-server-client-5.5.25-3.12.1 [done] Installing: mysql-community-server-5.5.25-3.12.1 [done]自動起動をOnにします。
# systemctl enable mysql.service mysql.service is not a native service, redirecting to /sbin/chkconfig. Executing /sbin/chkconfig mysql onサービスを起動します。
# systemctl start mysql.service Failed to issue method call: Unit mysql.service failed to load: No such file or directory. See system logs and 'systemctl status mysql.service' for details.エラーで起動できず。。。 原因がわからないので、一旦アンインストールして、パッケージの入手からやり直すことにします。 アンインストール。
# zypper remove mysql-community-server mysql-community-server-client mysql-community-server-errormessagesパッケージをMySQLのサイトからダウンロードします。SLESを選択して、MySQL ServerとClient Utilitiesをダウンロードします。 http://dev.mysql.com/downloads/mysql/5.5.html rpmパッケージをインストールします。
# rpm -ivh MySQL-server-5.5.27-1.sles11.x86_64.rpmPreparing... ########################################### [100%] ls: cannot access /var/lib/mysql/*.err: No such file or directory ls: cannot access /var/lib/mysql/*.err: No such file or directory 1:MySQL-server ########################################### [100%] insserv: Service network is missed in the runlevels 2 4 to use service mysql Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off # rpm -ivh MySQL-client-5.5.27-1.sles11.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-client ########################################### [100%]セキュリティ設定用のスクリプトを実行します。
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n]
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
お終い!
telnetでIMAPアクセス
# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS AUTH=CRAM-MD5 AUTH=LOGIN AUTH=PLAIN] Dovecot ready.
1 login mascotpark@lool.jp password
1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS] Logged in
2 list "" *
* LIST (\HasNoChildren) "." "INBOX"
2 OK List completed.
3 select INBOX
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $NotJunk)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft $NotJunk \*)] Flags permitted.
* 1 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1342696244] UIDs valid
* OK [UIDNEXT 2] Predicted next UID
* OK [HIGHESTMODSEQ 1] Highest
3 OK [READ-WRITE] Select completed.
4 fetch 1 body[]
* 1 FETCH (BODY[] {523}
Return-Path:
X-Original-To: mascotpark@lool.jp
Delivered-To: mascotpark@lool.jp
Received: by mail.lool.jp (Postfix, from userid 0)
id 4B8482003D4; Sat, 4 Aug 2012 14:20:25 +0900 (JST)
Date: Sat, 04 Aug 2012 14:20:25 +0900
To: mascotpark@lool.jp
Subject: hello
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20120804052025.4B8482003D4@mail.lool.jp>
From: root@mail.lool.jp (root)
test
)
4 OK Fetch completed.
5 logout
* BYE Logging out
5 OK Logout completed.
Connection closed by foreign host.
#
登録:
投稿 (Atom)