浏览模式: 标准 | 列表 全部文章

Linux VPS快速搭建magento环境与迁移magento网站

手头管理的某台vps因为特殊原因不能继续使用了,挂在其上基于LAMP环境的magento网站需要迁移到新的VPS上,本文就magento程序的特殊性,记录一下新环境的快速搭建以及迁移magento网站。新VPS系统是centos 5 32bit,以下操作都是基于此。

首先为新VPS快速搭建运行magento程序必须的LAMP环境,首先安装:

# wget -c http://dl.wdlinux.cn:5180/lanmp_v20.tar.gz

# tar zxvf lanmp_v20.tar.gz

#sh in.sh (选择1回车:apache + php + mysql + zend + eAccelerator + pureftpd + phpmyadmin)

安装pdo_mysql扩展(magento必须)

# wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz

tar zxvf PDO_MYSQL-1.0.2.tgz

cd PDO_MYSQL-1.0.2

/www/wdlinux/php/bin/phpize

./configure --with-php-config=/www/wdlinux/php/bin/php-config --with-pdo-mysql=/www/wdlinux/mysql

make && make install

#echo "extension=pdo_mysql.so">>/www/wdlinux/etc/php.ini

#service httpd restart (重启apache使扩展生效)

# /www/wdlinux/php/bin/php -m (通过此命令可以看到php所加载的扩展,包括pdo_mysql,有问题可以根据提示进行修改,比如路径错误导致找不到,则建立正确的扩展路径,错误修改后再次执行上一条命令使扩展生效。

lanmp_v20.tar.gz已经配置集成了rewrite规则与innodb存储引擎的配置信息,方便了部署,所以快速完成环境搭建之后就可以开始迁移magento网站:

  1. 在新的VPS上建立与旧VPS一样的网站配置(网站、数据库、配置文件)
  2. 将旧VPS与新VPS的mysql数据库停用,在旧VPS上打包mysql数据库:mysqldump -h localhost -uroot -p magento > /root/magento_db.sql
  3. 采用最直接省事的scp工具进行迁移,因为旧VPS的ssh默认端口被我修改为2222,所以命令有所改变,先迁移网站:scp -r  -P 2222 root@8.8.8.8:/www/web/magento/public_html/ /www/web/magento/public_html/
  4. 再迁移数据库:scp -r  -P 2222 root@8.8.8.8:/root/magento_db.sql /root/
  5. 将数据库导入:mysql -h localhost -uroot -p magento < /root/magento_db.sql (之前测试过直接打包数据库迁移过来解压缩到数据库存储目录不成功,只能如此)
  6. 启动新VPS上的mysql服务,将域名解析到新VPS,解析生效后测试网站是否正常

迁移后的提醒:

  • 迁移网站后如果无法正常访问,而是跳转到默认模板之类的情况发生,将网站的errors目录下的local.xml.sample修改为local.xml,刷新后就可以看到出错提示。
  • 网站使用了rewrite,但是打开产品页面却跳转404页面,那么就手动将magento的.htaccess传到网站根目录。

Tags: linux, vps, magento, pdo_mysql, innodb

linux mysql密码遗忘丢失找回来的方法

以下命令需要在root权限下执行:

首先要停止mysql服务,看一下mysql使用说明(启动、停止、重启、重启、重载、强制重载、状态),如下: 

# /etc/init.d/mysql

Usage: /etc/init.d/mysql  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]

停止mysql服务:

# /etc/init.d/mysql stop

执行mysql下的mysqld_safe,跳过权限与网络设置启动(以便下一步无须权限就可以进入数据库操作)

# /usr/local/mysql/bin/mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

使用mysql命令直接进入mysql数据库进行操作: 

# mysql -u root mysql

mysql> UPDATE user SET Password=PASSWORD('NewPassword') where USER='root';

mysql> FLUSH PRIVILEGES;

mysql> quit 

重启mysql服务使得mysql恢复正常运行:

# /etc/init.d/mysql restart

尝试用新密码登陆操作:

# mysql -uroot -p

Enter password: <输入重置的密码NewPassword>

简单几步,重置mysql密码。

Tags: mysql

在京东商城(360buy)买飞机票有惊喜

以前一直在淘宝旅行(jipiao.trip.taobao.com)买飞机票,方便、安全、快捷,这次综合对比下来发现一直网购的B2C网站京东商城的机票业务(jipiao.360buy.com)也非常给力,买机票直减现金(最高6%),还赠送最高50万航空意外伤害保障,活动时间2011.12.20-2011.12.31

简单对比了下,热门路线都是在票面价基础上都是直减6%,比如杭州至昆明、上海至昆明均是如此。而本次正冰购买的路线却因为非热门,只减了2.5%,1360元票面价,再减34元。

凭电子票号到www.travelsky.com查了下,发现京东代理了芒果网(www.mangocity.com)的机票。 

  • 机票销售单位名称:芒果网有限公司北京分公司
  • 地址:北京市朝阳区朝外雅宝路12号华声国际大厦18层02房间
  • 联系电话:010-85639918
  • 代理编号(Office号):PEK408
  • 国际航协代码(IATA):08316840

Tags: 京东商城, 360buy

为为网好不好?又似买特网第二!

买特网(www.360mart.com)是出了名的慢,一直在模仿京东,包括域名,但是却从未能超越它……

以前在买特网买过硬盘一个,拖了一周才给发货,伤不起,有木有?!

现在好了,出来一个为为网(www.homevv.com)与淘宝合作,还在Google Adwords上砸了蛮多钱做广告的(甚至包括正冰这个博客都显示它的广告,当然这个跟我最近不断访问它网站也有关系)。

好啦,接下来说下在这家网站的购物经历,真够悲剧的。


6号晚上(2011-12-06 23:54)单子买了个路由器(TP-LINK TL-WR941N 300M 无线宽带路由器),显示价格229元,用了公用券weiwei减22,再用去一张叠加券减20(淘宝5.4元购入),最终消费192.4元(这个价格相比较别的商家而且开发票已经非常给力

想着快递运输里说明浙江用户当天17点前下单可以发货(预计7号会发出),结果到了8号仍未发出,找在线客服,居然还是个用拼音输入法,不断打错别字的,被告知“长时间未发货为缺货,需要下午联系采购”,心里觉着遇到了第二个买特网了!马上搜索了下,在EGOU上发现有很多人遇到发货延迟情况。

我明了:发大额抵价券,占用用户资金,长时间不发货……(典型的“买特网”兄弟)

8号当日,我致电为为网4006-698-698,被告知会询问过采购后给予答复,当天下午,接到02196806电话告知该商品将在9号(周五)入库,尽快发出。

10号晚上查询该商品未发出,11号早上该商品送至中通快递,12号中午收到(产品拣货是10号,开票时间为10号)。

经过这次在为为网的购物,我想说的是:

  1. 这是我第一次在为为网购物,体验非常差,很难让我再来进行第二次购物。
  2. 又一家典型的“买特网”(不了解买特网的童鞋百度一下)
  3. 不专业客服说出的不专业的话:“采购现在不在 下午可能会在”,尼玛什么叫“可能”,上班都这么随意涣散?难道不能直接电话联系一下?
  4. 你们QQ客服的签名是“为您所想,为您所求”,我只能说:靠!
  5. 没有货的产品,请礼貌地显示缺货,不要在那里让大家下单了却没及时收货,然后等客户联系了才说没有货,自己做大爷。(我只能说艹你大爷)
  6. 无论这次购物最终如何,为为网将同买特网一样,至少进入我的购物“黑名单”,其他童鞋请参考!

以上可能为个例,请勿对号入座,个人实际案例仅供参考。因为该商家优惠额度较大,如果有童鞋要买不急于用的东西可以考虑尝试下……

Tags: 为为网, 买特网

正冰提醒:天上不掉馅饼,谨防国际诈骗!

以前有收到邮件,一般都是说有一笔巨额遗产免费赠送给你,让你与他取得联系,这种骗术已经有点老掉牙了。类似案例见《男子收到国际诈骗信 邀其接受400万美元遗产

而最近正冰居然收到了新式诈骗邮件(其实也不新,都在变而已),类似案例见《从非洲来的邮件--女大学生收到国际诈骗信

下面开始简单叙述正冰收到诈骗信的整个过程:

  • 11月4日收到来自lindyKumikombeh@yahoo.com的邮件(主题为:HELLO)说想与我交个朋友,我看邮件写得像模像样,也不像robot发送的,就顺手回了一个。
  • 11月23日无意间发现她在11月6日已经回复了我的邮件,洋洋洒洒一大片文字,主题为:about me,内容就是介绍她现在的情况,附带3张照片。具体内容见附1。根据她的邮件我也回了个mail,扯淡一番。
  • 11月25日在想那人是不是又那么积极地回邮件了,就去看了下邮箱,果不其然,她已经在11月24日就回复了邮件,这次更加夸张,直接让我在一个约定的时间里给她打电话(+221777512477),还说会把一笔多达750万美元的25%赠送给我。邮件主题:please help me。具体内容见附2。我心里想,750W*.25*6.4=1200W人民币,还有比中500W的概率还高的事情?顺手Google了一下这个号码,显然已经被登记在骗子列表中了,此刻我已经确信这是骗子无疑了,然后我便回了一个邮件给她:“我通过google搜索+221777512477是一个骗子电话,你做何解释?”你懂得,估计不会有下文了,难道她还会积极地回复我说这不是骗局?哈哈!

整个过程讲完了,下面讲讲这次亲身体验的案例中需要注意的地方:

  • 骗子已经从原来直接说给你遗产转变成先以交朋友的想法跟你套近乎,继而告诉你她的近况然后直接一刀切说让你帮助她,她会把巨额财富给你。
  • 这类骗子一般邮件里常用的词语就是death certificate(死亡证明书)、+221777512477 (Senegal, probably a prepaid mobile phone)

遇到类似正冰这种情况请直接不要理会,有兴趣的可以做以下2点操作:

  • 去google搜索关键词,比如发送者邮箱(一般来说对方会骗一次换一次)、对方提供的号码、对方所说的地方。
  • 去http://www.scamomatic.com/把邮件粘贴进去,检查是不是诈骗邮件,另外你所提交的信息还能够帮助到更多的人。

我把附2的内容放到scamomatic检测,结果如下:

This email looks like an orphan scam.

The following phrases should put you on alert:

"i will like you to ":

a common phrase found in 419 scams

"death certificate":

this phrase is often used in inheritance scams such as next of kin or orphan scams.

This email lists mobile phone numbers. Use of such numbers is typical for scams because they allow criminals to conceal their true location. They can receive calls in an Internet cafe from where they send you emails, while pretending to be in some office.

+221777512477 (Senegal, probably a prepaid mobile phone)

Thank you for using Scam-O-Matic. If you found the results from this check useful then please mention www.scamomatic.com to your friends, family and co-workers, so they can also use it to check out and report suspicious emails that may have been sent to them by criminals.

Once you have received any scam emails, it means the scammers know your email address. You will probably receive further scam emails. Therefore we recommend that you bookmark www.scamomatic.com (Ctrl+D) in your web browser for when you may need it again.

DISCLAIMER: While we try to give appropriate advice in the greatest number of cases, we must decline responsibilty for any mistakes that may occur. We encourage you to do your own research on the internet (for example, search on Google) and using other information sources. Get informed, talk to people you trust (your family, friends, your bank, local police) and then act accordingly.

翻译成中文:

这封电子邮件看起来像一个孤儿的骗局。

以下短语应该放在提醒您:

“我会想你”:

419诈骗发现一个共同的短语

“死亡证明书”:

这句话经常被用来在继承诈骗,如近亲或孤儿诈骗。

此电子邮件列出了手机号码。使用这样的数字是典型的为诈骗,因为它们允许犯罪分子隐瞒自己的真实位置。他们可以从网吧,在那里他们会给您发电子邮件接收呼叫,同时假装在一些办公室。

221777512477(塞内加尔,可能是预付费手机)

感谢您使用诈骗- O - MATIC。如果您发现从这个检查非常有用的结果,然后请注明www.scamomatic.com给你的朋友,家人和同事,让他们也可以使用它来检查和报告可疑的电子邮件可能已被犯罪分子发送给他们。

一旦你收到任何诈骗邮件,这意味着诈骗者知道您的电子邮件地址。你可能会得到进一步的诈骗电子邮件。因此,我们建议您在您的网页浏览器的书签时,您可能需要再次www.scamomatic.com(按Ctrl + D)。

免责声明:虽然我们竭尽所能给予适当的意见数量最多的案件,我们必须拒绝任何可能发生的错误responsibilty。我们鼓励你在互联网上做自己的研究(例如,在Google上搜索)和使用其他来源的信息。了解详情,与人交谈,你信任你的家人,朋友,您的银行,当地警方,然后采取相应的行动。

附1:

Dear,

How are you today?,i hope fine. Mine is not very good due to my suffering condition here in Dakar Senegal. I'm Miss lindy Kumikombeh,am from a famiy of three and am the eldest,I am 24years old, single girl and never married, 5 feet tall, 60 kg weight, black hair and brown eyes, I am from libya but presently i am residing in Church  Camp here in Senegal, as a result of civil war that was fought in my country which made me to lost my both parents during this mortal Political War that kills thousands of innocent souls in Libya. my family was among the first target of the rebels, because my late father Dr Robert Kumikombeh has a successful company, he was the Chairman and the managing director Kumikombeh Agricultural Industrial Company Ltd in tripole the capital city of my country,,and also a politician supporting the current government,so when the mortal political crisis were about to start due to my father was a politician who was supporting the current government during that time in my country all members of my family was murdered in cold blood and our family home was set ablaze. I was lucky to escaped death.

Is just me and my junior brother that is alive now and we managed to make our way to Senegal where we are staying now and never pray or think about our legs to step in that bloody country again.

I would like to know more about you, tell me your hobbies and what are you doing presently? I will tell you more about me in my next email. i attach my picture for you,and i will be looking forward to hear from you soon.send to me yours picture as well

Yours

lindy

附2:

Hello my dear

How are you today? i hope fine thanks for your mail and i am glad to know you. Dear like you know, i am living in the Church camp here in Dakar-Senegal. In this camp, it's just like one staying in a lonely zone like prison and i hope by God's grace, I will come out here soon since i met some one like you because i don't have any relatives now whom i can go to . so i am living in the refugee camp female's hostel as the camp has two hostels one for boys the other for women. Please try to call me by 2.pm GMT time in the afternoon tomorrow.The Church camp telephone number is: (+221777512477) when you call tell Rev Patric Kotor  that you want to speak with Mis lindy so that he will send for me in the hostel. Please call me tomorrow i will love to hear your voice.

As a refugee here, I don't have any right or privileged to have an account here because it is against the law of this country and also i don't like this country for anything that's why i contact you. I will like to continue with my studies in Medical department in a good university in your country because i only attended my first year in University of Libya before the tragic incident that led to the death of my parents took place. Please listen to this, I have my late father's statement of account and death certificate here with me which i will send to you later, because when my father was alive he deposited some amount of money in a leading bank in Dakar Senegal, which he used my name as the next of kin and the amount is 7.5Million USD seven Million five Hundred Thousand Dollars). So i will like you to help me transfer this money to your account and from it you can send me some money for me to get my travelling documents and air ticket to come over and meet you in your country after the transfer of the money to your account. I keep this secret to people in the camp here and no one knows about it, except you now. So in the light of above i will like you to keep it to yourself and don't tell it to anyone, I will like you to send me your below information for me to know you more and know whom the bank is going to transfer my inheritance to his account.

Below here is what i need from you so that I will give you the bank contact information:

(1) Your Full name

(2) Phone Numbers

(3) Occupation

(4) House or office address.

I will give you 25% percent of my total inheritance for assisting me in this transfer and you will also help me in the area of investing the remaining fund in any good business you know that will be giving us profit,i will like to continue with my studies in my carrier in health sector as i was in the university of Libya as a medical student before the war incident that made me to be in this situation

of life after the death of my beloved parents.

I will love to meet you very soon and thanks for your regards,I will like you to call me,call around 2.00pm GMT time in the afternoon. I want to hear your voice. Have a nice day and think about me. Awaiting to hear from you soonest.

Yours

lindy

Tags: scam

解决Can't connect to local MySQL server th...

之前mysql一直正常运行,重启之后打开网页就报错:Can't connect to local MySQL server through socket /var/lib/mysql/mysql.sock。

检查了一下这个位置发现并没有mysql.sock,而my.cnf中配置mysql.sock路径为/tmp/mysql.sock,netstat -nltp检查mysql却是正常运行的,说明mysql启动没有问题,奇怪了!

为了保障网站先正常运行,后续再找原因,这里给出一个快速解决方案(增加mysql目录,给mysql.sock做一个软链接):

mkdir /var/lib/mysql/

ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

然后去刷新出错页面,正常了。

Tags: mysql

解决Linux下大量SYN_SENT连接的问题

今日在迁移某个VPS之后发现原VPS居然有大量syn_sent连接指向新VPS的80端口。

一开始以为是原VPS上有配置文件的链接信息写的是域名的缘故(因为域名解析已经改为新VPS的IP,而有部分地区DNS未刷新),不过使用如下命令检查之后就发现不是这么回事。

netstat -atnp

参数p可以看到PID与Program name,只要是本机开启的服务端口,都是会有PID与Program name。检查之后发现是wget程序在占用,忽然想到是自己部署的一个定时check的脚本,用来检查网站是否正常。

解决方法就简单了,只要把bash程序的计划任务停止了即可。如果是其他不正常程序,只需要用kill命令把该PID杀死,如果是很多个进程,比如都是wget程序,那么只需要执行pkill -9 wget

Tags: syn_sent, bash

行尸走肉 第二季(The Walking Dead Season 2)下载

上半年看了行尸走肉 第一季(6集),觉得挺不错的,第二季最近又开始开播了。相信也有很多人很想马上看到,目前更新到了第二集,一周一等,无比煎熬!

《行尸走肉 第二季》(The Walking Dead Season 2)[YYeTs人人影视字幕组出品][中英双语字幕][更新06集][HR-HDTV,RMVB]

Tags: 行尸走肉