|||
Installing a Browser Mirror on Linux CentOS 7
#环境:CentOS Linux release 7.0.1406
#安装Mysql数据库。
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
service mysqld restart
mysql –u 用户名 –p 密码
create user 'user'@'localhost' identified by 'PASSWORD';
grant all privileges on hg19.* to 'user'@'localhost'
flush privileges;
#安装Apache。
#安装
yum -y install httpd
systemctl enable httpd.service
systemctl start httpd.service
#打开firewalld防火墙的80端口
firewall-cmd --add-service=http
firewall-cmd --permanent --add-service=http
sudo yum install libssl0.9.8
sudo ln -s /usr/lib/libssl.so.0.9.8 /usr/lib/libssl.so.6
sudo ln -s /usr/lib/libcrypto.so.0.9.8 /usr/lib/libcrypto.so.6
sudo mkdir /var/www/genomebrowser
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/htdocs/ /var/www/genomebrowser/
sudo mkdir -p /var/www/genomebrowser/cgi-bin
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/cgi-bin/ /var/www/genomebrowser/cgi-bin/
sudo chown -R 755 /var/www/genomebrowser/cgi-bin/
sudo chown -R 755 /var/www/genomebrowser/
sudo rm /var/www/genomebrowser/trash
sudo mkdir /var/www/genomebrowser/trash
sudo chown -R 755 /var/www/genomebrowser/trash
sudo mkdir -p /var/www/
sudo ln -s /var/www/genomebrowser/js/ /var/www/js
sudo ln -s /var/www/genomebrowser/style/ /var/www/style
gedit /var/www/genomebrowser/cgi-bin/hg.conf
# Configuration file for the UCSC Human Genome server
defaultGenome=Human
browser.documentRoot=/var/www/genomebrowser
# the format is in the form of name/value pairs, written as 'name=value'
# note that there is no space between the name and its value. Also, no blank lines #should be in this file.
# db.host is the name of the MySQL host to connect to
db.host=localhost
# db.user is the username used when connecting to the host
db.user=user
# this is the password to use with the above hostname
db.password=PASSWORD
db.trackDb=trackDb
# central.host is the name of the host of the central MySQL
# database where stuff common to all versions of the genome
# and the user database is stored.
central.db=hgcentral
central.host=localhost
central.user=user
central.password=PASSWORD
central.domain=
backupcentral.db=hgcentral
backupcentral.host=localhost
backupcentral.user=user
backupcentral.password=PASSWORD
backupcentral.domain=
sudo chown -R 755 /var/www/genomebrowser/cgi-bin/hg.conf
#配置Apache服务器,使下载的html、cgi-bin可以正常显示。gedit /usr/local/apache/conf/httpd.conf
###########################修改以下内容####################DocumentRoot "/var/www/"
#Setting for genomebrowser in httpd.conf
#Enable SSI
XBitHack on
<Directory /var/www/genomebrowser/>
AllowOverride AuthConfig
Options Indexes FollowSymLinks MultiViews Includes
Order allow,deny
allow from all
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</Directory>
#Enable CGI
ScriptAlias /genomebrowser/cgi-bin/ "/var/www/genomebrowser/cgi-bin/"
<Directory "/var/www/genomebrowser/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
AddHandler cgi-script cgi pl
</Directory>
#重启apache2服务器
sudo service apache2 restart
#若此时出现CGI "Internal Server Error" 错误,则可以通过更改/var/www/genomebrowser/cgi-bin/的权限来解决chmod 755 -R /var/www/genomebrowser/cgi-bin
sudo service apache2 restart
sudo chown -R mysql:mysql /var/lib/mysql
#重启mysqlsudo service mysql restart
#此时可以看到genomebrowser,如果显示不正常,导航栏异常,原因在于Redhat下Apache没有默认地读取htdocs(Ubuntu下Apache默认是读htdocs的)cp -R /var/www/genomebrowser/style /var/www/
cp -R /var/www/genomebrowser/js /var/www/
chmod 777 -R /var/www/genomebrowser/trash/
#如果遇到导航栏中某些链接指向www/cgi-bin的问题(因为默认的UCSC浏览器是放在www下的),目前比较保守的解决办法是将genomebrowser/cgi-bin下的文件复制到www/cgi-bin(注意此方法并未完全解决链接问题)cp -Rf /var/www/genomebrowser/cgi-bin/* /var/www/cgi-bin/
#建立Mysql tables。wget http://hgdownload.cse.ucsc.edu/admin/hgcentral.sql
mysql -u root -p -e "create database hgcentral"
mysql -u root -p hgcentral < /home/download/hgcentral.sql
mysql -u root -p -e "grant all privileges on hgcentral.* to 'user'@'localhost'"
mysql -u root -p -e "create database hgFixed"
mysql -u root -p -e "grant select on hgFixed.* to 'user'@'localhost'"
sudo mkdir /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/ /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/grp.MYD /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/grp.MYI /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/grp.frm /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/trackDb.MYD /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/trackDb.MYI /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/trackDb.frm /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/hgFindSpec.MYD /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/hgFindSpec.MYI /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/hgFindSpec.frm /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/chromInfo.MYD /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/chromInfo.MYI /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/chromInfo.frm /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/gold.MYD /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/gold.MYI /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/gold.frm /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/gap.MYD /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/gap.MYI /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/gap.frm /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/oregannoAttr.MYD /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/oregannoAttr.MYI /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/oregannoAttr.frm /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/refLink.MYD /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/refLink.MYI /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hg19/refLink.frm /var/lib/mysql/hg19
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/hgFixed/ /var/lib/mysql/hgFixed
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/uniProt/ /var/lib/mysql/uniProt/sp120323/
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/swissProt/ /var/lib/mysql/uniProt/sp111004/
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/proteome/ /var/lib/mysql/proteinDB/proteins120806/
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/mysql/proteins/ /var/lib/mysql/proteinDB/proteins111004/
sudo mkdir /gbdb
chmod 755 -R /gbdb
sudo rsync -avzP rsync://hgdownload.cse.ucsc.edu/gbdb/hg19/ /gbdb/hg19/
4、如果已经下载了本地化相关的大量文件,完全可以通过复制的办法来重新本地化,无需再次从UCSC网站下载。
5、如果本地根目录空间太小,无法存放mysql和gbdb两个超级文件夹,可以通过软链接(ln)的方式将其转移至较大的空间内。
(1)转移mysql目录:
cp -aR /var/lib/mysql/. /pub3/mysql
cd /var/lib/
mv mysql mysql_bei #将原有的mysql重命名,作为备份以防万一,同时也为成功做软链接做准备
#ln -s /pub3/mysql /var/lib/mysql (软链接的方式再CentOS 7下不起作用)
#直接通过修改mysql的配置文件将数据地址更改至新地址
#
如果/etc/目录下没有my.cnf配置文件,请到/usr/share/mysql/下找到*.cnf文件,拷贝其中一个到/etc/并改名为my.cnf)中。命令如下:
[root@test1 mysql]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
5、编辑MySQL的配置文件/etc/my.cnf
为保证MySQL能够正常工作,需要指明mysql.sock文件的产生位置。修改socket=/var/lib/mysql/mysql.sock一行中等号右边的值为:
/home/mysql/mysql.sock 。操作如下:
vi my.cnf (用vi工具编辑my.cnf文件,找到下列数据修改之)
#把其中datadir=/var/lib/mysql一行中,等号右边的路径改成你现在的实际存放路径:datadir=/pub3/mysql。
#datadir=/var/lib/mysql
datadir=/pub3/mysql
# The MySQL server[mysqld] port = 3306
#socket =/pub3/mysql/mysql.sock(原内容,为了更稳妥用“#”注释此行)
socket = /pub3/mysql/mysql.sock (加上此行)
#更改/usr/bin/mysql_config-64中这个文件里面有一行“ldata='/var/lib/mysql'”
#和"socket=/var/lib/mysql/mysql.sock",这里也需要改掉
错误原因分析及解决方案:
在CentOS上,如果mysql是通过yum安装的,那么可能使用上面的方法不能完全凑效。
原因:mysql的配置文件有多处,除了更改/etc/my.cnf文件之外,还需要更改/usr/lib64/mysql/mysql_config
这个文件里面有一行“ldata='/var/lib/mysql'”和"socket=/var/lib/mysql/mysql.sock",这里也需要改掉
chown -R mysql:mysql /pub3/mysql
service mysql start
cp -aR /gbdb/. /pub3/gbdb
mv gbdb gbdb_bei #以防万一
ln -s /pub3/gbdb /gbdb
其他供参考的UCSC本地化教程:
UCSC Genome Browser 本地化官方指南 (详细wiki)
UCSC Genome Browser 本地化Google论坛
UCSC Genome Browser 本地安装指南 by 卢金龙
UCSC Genome Browser 本地化安装指南(Ubuntu)by 吕杰
For any more questions, please contact hongbo919@gmail.com.
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-27 00:13
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社