user@user-virtual-machine:~$ sudo vmware-tools-distrib/vmware-install.plカーネルのヘッダが無いと言っているらしい。
...(省略)
Enter the path to the kernel header files for the 3.5.0-17-generic kernel?
The path "" is not a valid path to the 3.5.0-17-generic kernel headers.
Would you like to change it? [yes]
user@user-virtual-machine:~$ uname -aカーネルのバージョンは、"3.5.0-17-generic" ですね。
Linux user-virtual-machine 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
user@user-virtual-machine:~$
user@user-virtual-machine:~$ sudo apt-get install linux-headers-3.5.0-17-genericヘッダーファイルのインストールが完了しました。
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
以下のパッケージが新たにインストールされます:
linux-headers-3.5.0-17-generic
アップグレード: 0 個、新規インストール: 1 個、 削除: 0 個、保留: 278 個。
946 kB のアーカイブを取得する必要があります。
この操作後に追加で 11.2 MB のディスク容量が消費されます。
取得:1 http://jp.archive.ubuntu.com/ubuntu/ quantal/main linux-headers-3.5.0-17-generic amd64 3.5.0-17.28 [946 kB]
946 kB を 0秒 で取得しました (1,127 kB/s)
以前に未選択のパッケージ linux-headers-3.5.0-17-generic を選択しています。
(データベースを読み込んでいます ... 現在 144630 個のファイルとディレクトリがインストールされています。)
(.../linux-headers-3.5.0-17-generic_3.5.0-17.28_amd64.deb から) linux-headers-3.5.0-17-generic を展開しています...
linux-headers-3.5.0-17-generic (3.5.0-17.28) を設定しています ...
user@user-virtual-machine:~$
user@user-virtual-machine:~$ sudo vmware-tools-distrib/vmware-install.pl先ほどインストールしたバージョンのヘッダーファイルを認識しているようで、
...(省略)
Searching for a valid kernel header path...
Detected the kernel headers at "/lib/modules/3.5.0-17-generic/build/include".
The path "/lib/modules/3.5.0-17-generic/build/include" appears to be a valid
path to the 3.5.0-17-generic kernel headers.
Would you like to change it? [no]
...(省略)
Enjoy,
--the VMware team
Found VMware Tools CDROM mounted at /media/user/VMware Tools. Ejecting device
/dev/sr0 ...
user@user-virtual-machine:~$
mysql> CREATE TABLE tbl_test -> ( -> id int NOT NULL AUTO_INCREMENT, -> value int NOT NULL, -> insdate timestamp NOT NULL, -> CONSTRAINT pk_tbl_test PRIMARY KEY (id) -> ); Query OK, 0 rows affected (0.14 sec) mysql> CREATE VIEW vw_test AS -> SELECT -> DATE_FORMAT(insdate, '%Y%m') AS year_month, SUM(value) AS sum_value -> FROM -> tbl_test -> GROUP BY -> year_month; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'year_month, SUM(value) AS sum_value FROM tbl_test GROUP BY year_month' at line 3 mysql>
mysql> CREATE VIEW vw_test AS -> SELECT -> DATE_FORMAT(insdate, '%Y%m') AS `year_month`, SUM(value) AS sum_value -> FROM -> tbl_test -> GROUP BY -> `year_month`; Query OK, 0 rows affected (0.01 sec)
mysql> select * from vw_test where year_month = '201212'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'year_month = '201212'' at line 1
mysql> select * from vw_test where `year_month` = '201212'; +------------+-----------+ | year_month | sum_value | +------------+-----------+ | 201212 | 1000 | +------------+-----------+ 1 row in set (0.00 sec)
[user@localhost ~]$ whois google.co.jp [Querying whois.jprs.jp] [whois.jprs.jp] [ JPRS database provides information on network administration. Its use is ] [ restricted to network administration purposes. For further information, ] [ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e' ] [ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'. ] Domain Information: a. [Domain Name] GOOGLE.CO.JP g. [Organization] Google Japan l. [Organization Type] corporation m. [Administrative Contact] DL152JP n. [Technical Contact] TW124137JP p. [Name Server] ns1.google.com p. [Name Server] ns2.google.com p. [Name Server] ns3.google.com p. [Name Server] ns4.google.com s. [Signing Key] [State] Connected (2013/03/31) [Registered Date] 2001/03/22 [Connected Date] 2001/03/22 [Last Update] 2012/08/06 14:26:57 (JST)
[use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e']
[user@localhost ~]$ which whois /usr/bin/whois [user@localhost ~]$ which jwhois /usr/bin/jwhois [user@localhost ~]$ ls -l /usr/bin/whois lrwxrwxrwx 1 root root 6 7月 5 2010 /usr/bin/whois -> jwhois
"\\.jp$" { whois-server = "whois.jprs.jp"; query-format = "$* /e"; }
[user@localhost ~]$ whois google.co.jp [Querying whois.jprs.jp] [whois.jprs.jp] [ JPRS database provides information on network administration. Its use is ] [ restricted to network administration purposes. For further information, ] [ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e' ] [ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'. ] Domain Information: [ドメイン情報] a. [ドメイン名] GOOGLE.CO.JP e. [そしきめい] ぐーぐるかぶしきかいしゃ f. [組織名] グーグル株式会社 g. [Organization] Google Japan k. [組織種別] 株式会社 l. [Organization Type] corporation m. [登録担当者] DL152JP n. [技術連絡担当者] TW124137JP p. [ネームサーバ] ns1.google.com p. [ネームサーバ] ns2.google.com p. [ネームサーバ] ns3.google.com p. [ネームサーバ] ns4.google.com s. [署名鍵] [状態] Connected (2013/03/31) [登録年月日] 2001/03/22 [接続年月日] 2001/03/22 [最終更新] 2012/08/06 14:26:57 (JST) [user@localhost ~]$
[root@localhost ~]# /etc/rc.d/init.d/httpd restart Stopping httpd: [OK] Starting httpd: [warn] _default_ VirtualHost overlap on port 80, the first has precedence [OK] [root@localhost ~]#
[root@localhost ~]# /etc/rc.d/init.d/httpd restart Stopping httpd: [OK] Starting httpd: [OK] [root@localhost ~]#
[root@localhost etc]# /etc/rc.d/init.d/mysqld restart Stopping MySQL: [FAILED] touch: cannot touch `/var/log/mysql/error.log': No such file or directory chown: cannot access `/var/log/mysql/error.log': No such file or directory chmod: cannot access `/var/log/mysql/error.log': No such file or directory Initializing MySQL database: Installing MySQL system tables... /usr/libexec/mysqld: File '/var/log/mysql/bin-index.log' not found (Errcode: 2) 121115 14:58:33 [ERROR] Aborting 121115 14:58:33 [Note] /usr/libexec/mysqld: Shutdown complete Installation of system tables failed! Examine the logs in /var/lib/mysql for more information. You can try to start the mysqld daemon with: shell> /usr/libexec/mysqld --skip-grant & and use the command line tool /usr/bin/mysql to connect to the mysql database and look at the grant tables: shell> /usr/bin/mysql -u root mysql mysql> show tables Try 'mysqld --help' if you have problems with paths. Using --log gives you a log in /var/lib/mysql that may be helpful. Please consult the MySQL manual section 'Problems running mysql_install_db', and the manual section that describes problems on your OS. Another information source are the MySQL email archives available at http://lists.mysql.com/. Please check all of the above before mailing us! And remember, if you do mail us, you MUST use the /usr/bin/mysqlbug script! [FAILED]
[root@localhost etc]# cd /etc [root@localhost etc]# mv my.cnf my.cnf.new [root@localhost etc]# mv my.cnf.org my.cnf [root@localhost etc]# [root@localhost etc]# mysql_install_db Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h localhost password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! [root@localhost etc]#
[root@localhost etc]# /etc/rc.d/init.d/mysqld start Starting MySQL: [ OK ] [root@localhost etc]#
[root@localhost etc]# /etc/rc.d/init.d/mysqld stop Stopping MySQL: [ OK ] [root@localhost etc]# [root@localhost etc]# mv my.cnf my.cnf.org [root@localhost etc]# mv my.cnf.new my.cnf [root@localhost etc]# /etc/rc.d/init.d/mysqld start touch: cannot touch `/var/log/mysql/error.log': No such file or directory chown: cannot access `/var/log/mysql/error.log': No such file or directory chmod: cannot access `/var/log/mysql/error.log': No such file or directory MySQL Daemon failed to start. Starting MySQL: [FAILED] [root@localhost etc]#
[root@localhost etc]# mkdir /var/log/mysql [root@localhost etc]# ls -l /var/log/mysql total 0 [root@localhost etc]# ls -ld /var/log/mysql drwxrwxr-x 2 root root 4096 Nov 15 16:33 /var/log/mysql [root@localhost etc]# chown mysql:mysql /var/log/mysql [root@localhost etc]# ls -ld /var/log/mysql drwxrwxr-x 2 mysql mysql 4096 Nov 15 16:33 /var/log/mysql [root@localhost etc]# [root@localhost etc]# /etc/rc.d/init.d/mysqld start MySQL Daemon failed to start. Starting MySQL: [FAILED] [root@localhost etc]#
[root@localhost etc]# vi /var/log/mysql/error.log -------- ログの内容 -------- 121115 16:34:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 121115 16:34:59 [Note] Plugin 'ndbcluster' is disabled. InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes InnoDB: than specified in the .cnf file 0 16777216 bytes! 121115 16:35:00 [ERROR] Plugin 'InnoDB' init function returned error. 121115 16:35:00 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 121115 16:35:00 [ERROR] Unknown/unsupported table type: InnoDB 121115 16:35:00 [ERROR] Aborting 121115 16:35:00 [Note] /usr/libexec/mysqld: Shutdown complete 121115 16:35:00 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended --------- /ログの内容 --------
[root@localhost etc]# rm /var/lib/mysql/ib ibdata1 ib_logfile0 ib_logfile1 [root@localhost etc]# rm /var/lib/mysql/ib* rm: remove regular file `/var/lib/mysql/ibdata1'? y rm: remove regular file `/var/lib/mysql/ib_logfile0'? y rm: remove regular file `/var/lib/mysql/ib_logfile1'? y [root@localhost etc]# /etc/rc.d/init.d/mysqld start Starting MySQL: [ OK ] [root@localhost etc]#
<html> <head> <title>test</title> </head> <body> <?php for ($i = 0; $i < 3; $i++): ?> <p>This is test. line <?php echo $i; ?></p> <?php endfor; ?> </body> </html>
[user@hostname work]$ php test_success.php <html> <head> <title>test</title> </head> <body> <p>This is test. line 0</p> <p>This is test. line 1</p> <p>This is test. line 2</p> </body> </html> </pre>
<html> <head> <title>test</title> </head> <body> <?php for ($i = 0; $i < 3; $i++): ?> <p>This is test. line <?php echo $i; ?></p> <? endfor; ?> </body> </html>
[user@hostname work]$ php test_fail.php PHP Parse error: syntax error, unexpected $end in /home/user/work/test_fail.php on line 11
$ sudo ./vmware-tools-distrib/bin/vmware-config-tools.pl $ sudo /etc/init.d/networking stop $ sudo rmmod pcnet32 $ sudo rmmod vmxnet $ sudo modprobe vmxnet $ sudo /etc/init.d/networking start $ sudo /usr/bin/vmware-user
user@ubuntu:~$ ls /mnt/hgfs/ user@ubuntu:~$
user@ubuntu:~$ ls /mnt/hgfs/ hostroot/ hostworkspace/ user@ubuntu:~$
$ sudo apt-get install mysql-serverインストールしたら、default-character-set を適切な文字コードに設定しておいた方が良いかと。
$ sudo vi /etc/mysql/my.cnf $ sudo /etc/init.d/mysql restartRMySQL
$sudo R > install.packages("DBI") > install.packages("RMySQL")しかし、RMySQLのインストールに失敗する。 以下のような感じで怒られる。
Configuration error: could not find the MySQL installation include and/or library directories. Manually specify the location of the MySQL libraries and the header files and re-run R CMD INSTALL. INSTRUCTIONS: 1. Define and export the 2 shell variables PKG_CPPFLAGS and PKG_LIBS to include the directory for header files (*.h) and libraries, for example (using Bourne shell syntax): export PKG_CPPFLAGS="-I" export PKG_LIBS="-L -lmysqlclient" Re-run the R INSTALL command: R CMD INSTALL RMySQL_ .tar.gz 2. Alternatively, you may pass the configure arguments --with-mysql-dir= (distribution directory) or --with-mysql-inc= (where MySQL header files reside) --with-mysql-lib= (where MySQL libraries reside) in the call to R INSTALL --configure-args='...' R CMD INSTALL --configure-args='--with-mysql-dir=DIR' RMySQL_ .tar.gz ERROR: configuration failed for package ‘RMySQL’ * removing ‘/usr/local/lib/R/site-library/RMySQL’ ダウンロードされたパッケージは、以下にあります ‘/tmp/RtmpKb6C3d/downloaded_packages’ 警告メッセージ: In install.packages("RMySQL") : パッケージ '‘RMySQL’' のインストールは、ゼロでない終了値をもちました
$ sudo apt-get install libmysqlclient-dev再度RMySQLをインストールしてみる。
> install.packages("RMySQL") パッケージを ‘/usr/local/lib/R/site-library’ 中にインストールします (‘lib’ が指定されていないので) --- このセッションで使うために、CRANのミラーサイトを選んでください --- Tcl/Tkインターフェースのロード中 終了済 URL 'http://cran.ism.ac.jp/src/contrib/RMySQL_0.8-0.tar.gz' を試しています Content type 'application/x-gzip' length 160735 bytes (156 Kb) 開かれた URL ================================================== downloaded 156 Kb * installing *source* package ‘RMySQL’ ... checking for gcc... gcc ・ ・ ・ ** testing if installed package can be loaded * DONE (RMySQL) ダウンロードされたパッケージは、以下にあります ‘/tmp/RtmpMOcKI7/downloaded_packages’よし、成功。 実際に接続してみる。
> library(RMySQL) 要求されたパッケージ DBI をロード中です > m <- dbDriver("MySQL") > dbconnector <- dbConnect(m, host="localhost", dbname="itemdb_test", user="item", password="item") > query.result <- dbSendQuery(dbconnector, "select * from item") > item.table <- fetch(query.result) > dbDisconnect(dbconnector) [1] TRUE > > item.table item_id url domain_age_day a_strlen_rate 1 1 0 0.00 2 2 0 0.00RからMySQLのデータをSELECTできました。