月別アーカイブ: 2015年4月

conoha

vim /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 20 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 21 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 25 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 60000:60030 -j ACCEPT

#service iptables restart

#/etc/rc.d/init.d/httpd start

#yum -y install vsftpd

#useradd centosuser
#passwd centosuser
centosuserxxxx
centosuserxxxx

#vim /etc/vsftpd/vsftpd.conf

ascii_upload_enable=YES
ascii_download_enable=YES

pasv_promiscuous=YES
pasv_min_port=60000
pasv_max_port=60030
use_localtime=YES
ssl_enable=YES
rsa_cert_file=/etc/pki/tls/certs/vsftpd.pem
force_local_logins_ssl=YES
force_local_data_ssl=YES
allow_anon_ssl=NO
ssl_ciphers=HIGH
require_ssl_reuse=NO

# cd /etc/pki/tls/certs/ ← ディレクトリ移動
# make vsftpd.pem 

Country Name (2 letter code) [GB]:JP ※国名
State or Province Name (full name) [Berkshire]:Tokyo ※都道府県名
Locality Name (eg, city) [Newbury]:Shinjuku ※市区町村名
Organization Name (eg, company) [My Company Ltd]:linuxserver.jp ※組織名
Organizational Unit Name (eg, section) []:admin ※組織の部署名
Common Name (eg, your name or your server’’s hostname) []:linuxserver.jp ※サーバーホスト名
Email Address []:webmaster@linuxserver.jp ※メールアドレス

#/etc/rc.d/init.d/vsftpd start
または、service vsftpd restart

#cd /var
#chown centosuser.centosuser -R www/

#vim /etc/php.ini
date.timezone = Asia/Tokyo
#/etc/rc.d/init.d/httpd restart

template_c 777
cash 777

#yum install php-mysql
#yum install mysql-server
#service mysqld start
#mysql

/etc/rc.d/init.d/httpd restart

・Notice: Undefined
Notice: Undefined variable: user_id in

#vim /etc/php.ini
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

#yum install phpMyAdmin

apacheを再起動します。
※再起動は「/etc/rc.d/init.d/httpd restart」で行えます。

http://xxx.com/phpmyadmin

にてアクセス
you don’t have permission to access /phpmyadmin on this server.
のエラーがでるhttp://www.deep-deep.jp/blog_engineer/archives/1996

を参考にして
vi /etc/httpd/conf.d/phpMyAdmin.conf

# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1

のDeny from Allをコメントアウト#
apacheを再起動します。
※再起動は「/etc/rc.d/init.d/httpd restart」で行えます。

rootパスワード設定

http://qiita.com/daichi87gi/items/f9dac6cd8acc3ad4330d

参考
mysql

rootのパスワードを確認
mysql -u root -p
passwordに対しリターン(パスワードなしで)入れてしまう

USE mysql;

update mysql.user set password=password(‘root用の任意パスワード’) where user = ‘root’;

FLUSH PRIVILEGES;
quit
mysql -u root -p
で、rootにパスワードが設定されたか確認する

・error対策
Call to undefined function mb_convert_kana()

参考
http://www.tekboy.net/archives/704

・エラー対策
Fatal error: Call to undefined function mb_convert_kana()

yum install php-mbstring
apacheを再起動します。
/etc/rc.d/init.d/httpd restart

・別サーバからのphpMyAdmin接続する場合

DBのあるサーバ側で
どこからでも入れるアカウントを作成する
GRANT ALL PRIVILEGES ON *.* TO hogeuser@”%” IDENTIFIED BY ‘passo’ WITH GRANT OPTION;

別サーバ(端末)からの接続確認
mysql -h (ホスト名またはIP)-u hogeuser

phpMyAdminを設置した側のサーバにて
cp /etc/phpMyAdmin/config.inc.php /etc/phpMyAdmin/config.inc2.php
vi /etc/phpMyAdmin/config.inc.php
#$cfg[‘Servers’][$i][‘host’]= ‘localhost’;
$cfg[‘Servers’][$i][‘host’]= ‘xxx.xxx.xxx.xxx’;

で、接続先を設定する

conoHaで構築

・sshでログイン
Tera Termをインストール

Keyをダウンロード
ホスト名
 console1xxxx.cnode.jp
ユーザ名
 iu3-xxx08091
Keyをダウンロードファイル
を指定しログイン

・apacheでWebサービスを立ち上げる

apacheが入っているか調べる
# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Apr 3 2014 23:56:16

入っている

apache起動しているか調べる
# /etc/rc.d/init.d/httpd status
httpd is stopped
止まっている

ポート80を開ける
vim /etc/sysconfig/iptables
# 以下の内容を追記
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
# iptablesを再起動します
# service iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]

コンテンツ作成
#vim /var/www/html/index.html

apache起動
# /etc/rc.d/init.d/httpd start

http://xx.xxx.xxx

・ftpをインスツールする
#vsftpd -v
-bash: vsftpd: command not found

#yum -y install vsftpd

-A INPUT -m state –state NEW -m tcp -p tcp –dport 20 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 21 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 60000:60030 -j ACCEPT

service iptables restart

useradd centosuser
passwd centosuser
centosuserxxxx
centosuserxxxx

#vim /etc/vsftpd/vsftpd.conf

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
———-このあとに—-
ascii_upload_enable=YES
ascii_download_enable=YES

pasv_promiscuous=YES
pasv_min_port=60000
pasv_max_port=60030
use_localtime=YES
ssl_enable=YES
rsa_cert_file=/etc/pki/tls/certs/vsftpd.pem
force_local_logins_ssl=YES
force_local_data_ssl=YES
allow_anon_ssl=NO
ssl_ciphers=HIGH

# cd /etc/pki/tls/certs/ ← ディレクトリ移動
# make vsftpd.pem 

Country Name (2 letter code) [GB]:JP ※国名
State or Province Name (full name) [Berkshire]:Tokyo ※都道府県名
Locality Name (eg, city) [Newbury]:Shinjuku ※市区町村名
Organization Name (eg, company) [My Company Ltd]:linuxserver.jp ※組織名
Organizational Unit Name (eg, section) []:admin ※組織の部署名
Common Name (eg, your name or your server’’s hostname) []:linuxserver.jp ※サーバーホスト名
Email Address []:webmaster@linuxserver.jp ※メールアドレス

#/etc/rc.d/init.d/vsftpd start
または、service vsftpd restart

#cd /var/www
#chown centosuser.centosuser -R html/

・FileZillaでの接続

タブ[一般]
プロトコール:FTP-ファイル転送プロトコール
暗号化:明示的なFTPoverTLSが必要
(Require explicit FTP over TLS)

タブ[転送設定]
パッシブ

listが出ないときは
#vim /etc/vsftpd/vsftpd.conf
“require_ssl_reuse=NO”

#/etc/rc.d/init.d/vsftpd restart
または、service vsftpd restart

・Error対応
Warning: strftime(): It is not safe to rely on the system’s timezone settings

#vim /etc/php.ini
date.timezone = Asia/Tokyo

#/etc/rc.d/init.d/httpd restart
または、service httpd restart

・書き込み属性templates_c
Fatal error: Uncaught exception ‘SmartyException’ with message ‘unable to write file ../Smarty/templates_c/

templates_c ->777
config   ->777

・mysqlインスツール
#yum install php-mysql
#yum install mysql-server
#service mysqld start
#mysql

・Notice: Undefined
Notice: Undefined variable: user_id in

#vim /etc/php.ini
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

・ubuntuからのssh接続法
keyPairをダウンロード
/tmp/xxxx-1.key
へ移動

chmod 600 /tmp/xxxx-1.key
#ssh -i /tmp/xxx-x.key iu3-0000xxx@consolexxxx.cnode.jp

・phpmysqladminインスツール
yum -y install –enablerepo=epel install -y phpMyAdmin php-mysql php-mcrypt
apacheを再起動します。
※再起動は「/etc/rc.d/init.d/httpd restart」で行えます。

http://xxx.com/phpmyadmin
にてアクセス
you don’t have permission to access /phpmyadmin on this server.
のエラーがでる
http://www.deep-deep.jp/blog_engineer/archives/1996
を参考にして
vi /etc/httpd/conf.d/phpMyAdmin.conf


# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1

のDeny from Allをコメントアウト#
apacheを再起動します。
※再起動は「/etc/rc.d/init.d/httpd restart」で行えます。

rootパスワード設定
http://qiita.com/daichi87gi/items/f9dac6cd8acc3ad4330d
参考
mysql

rootのパスワードを確認
mysql -u root -p
passwordに対しリターン(パスワードなしで)入れてしまう

USE mysql;
— Hostを無視して更新したい場合はhost=’localhost’ は消しておけばよさそう
UPDATE user SET password=PASSWORD(‘your_password’) WHERE host=’localhost’ AND user=’root’;
FLUSH PRIVILEGES;
quit
mysql -u root -p
で、rootにパスワードが設定されたか確認する

・mysql-workbench
sudo apt-get install mysql-workbench

mysql-workbench &
で起動