拖了一个月终于着手并且完成了。其实没有什么难的。但是因为我对Linux的了解非常局限,还是花了一番功夫,同时学了很多东西,在这里记一下。没有试图写一篇“手把手教你搬WP”,只是记录一些我觉得有帮助的东西,希望做同样的事情的且同样不是那么牛逼的Linux学习者们有用:)
虽说是WordPress搬家,但是任何一个小型网站搬家都差不多这样了吧,嘿嘿。
如果用cPanel和MySQLAdmin之类的东西可能就很傻瓜,但是第一cPanel太贵了(竟然要425多刀一年,我都笑了),第二VPS都买了必须必须要抓住每一个学Linux的机会啊。
过程如下(断断续续弄了好几天…):
环境
虚拟主机和VPS都是host2ez的,最牛逼的主机提供商。系统是CentOS Linux 5.6,apache(现在改名叫httpd)已经装好了,再装
yum php mysql mysql-server
就成。
文件
这个简单,cPanel把虚拟主机上文件打包,VPS上wget下来就好。WP的独立性做的好,文件路径改变不会有什么问题。备份用的插件BackUpWordpress倒因为出问题了,不能识别路径,我直接禁用掉了,VPS嘛马上弄个备份方案还不容易,不需要用WP的插件了。在[wordpress path]/wp_config.php里把信息改一下,数据库部分的怎么改见下面。
数据库
对数据库命令不了解的同学建议先看一下mysql的教程。我不能把所有操作都写出来…这次弄这个还学了不少数据库的东西…tutorial很容易搜到,我觉得有一个比较好的命令列表点 这里,里面包括了所有常用的命令。
在虚拟主机的cPanel – mysqladmin里备份出.sql文件,传上VPS,导入文件的命令是
mysql – u user_name -p database_name < file_name.sql
很多地方写的-p后面跟密码,我用的版本-p后面不跟东西,回车以后才提示输密码,可能是新版本不提倡显式输入密码了吧。非要用的话就–password=”xxxxxx”
如果你导出文件选的是整个mysql,需要打开文件把database”information_schema”部分删掉,否则会失败,这个db貌似是mysql自己的,不能改..不懂
之后要建立一个用户并给此用户分配使用相应db的权限,虽然我们也可以直接把root用户写进wp_config.php但是稍微有点安全意识的程序员都不会想要这么做的…虽然权限没什么大不了的,但是名字叫root就是不行! 所以进数据库:
mysql -u root -p
进去以后添加用户:
mysql> create user 'username'@'localhost' identified by 'mypass';
分配权限:
mysql> grant all privileges on databasename.* to username@localhost; mysql> flush privileges;
然后就把这个用户甩给Wordpress啦(编辑wp_config.php)
测试的时候有一些问题
上面完了就能http进vps的ip看到博客了,但是不要去点任何东西…因为数据库里“本站”的地址还是原来的域名,这样如果你原来的网站还开着那么随便点个链接就进到原来网站了,如果没开那就can’t find page啦。
而且因为没法进后台改,所以只好进mysql改了
mysql> use viaxlcom_viaxlcom; mysql> select * from wp_options where option_value rlike "^http"; +-----------+---------+-------------+----------------------------+----------+| option_id | blog_id | option_name | option_value | autoload | +-----------+---------+-------------+----------------------------+----------+ | 2 | 0 | siteurl | http://axlarts.com/blog | yes | | 39 | 0 | home | http://axlarts.com | yes | | 41 | 0 | ping_sites | http://rpc.pingomatic.com/ | yes | +-----------+---------+-------------+----------------------------+----------+ 3 rows in set (0.06 sec) update wp_options set option_value="http://12.34.56.78/blog" where option_id=2; update wp_options set option_value="http://12.34.56.78" where option_id=39;
这样就把VPS上的网站地址改成本身的IP了。
————————————-
另外我发现一些插件会出现权限问题,比如JW player(放flv视频用的插件),没法启用插件因为提示不能写目录,我整个www目录都是755权限,设置成777以后可以开启了,然后再弄回来。这个问题解决了但是原因一直不知道,直到我因为另一个问题搜了一下才搞明白。
另一个问题是:更新插件update的时候会提示我输入ftp帐号,以前没这事啊,于是我就去装了个vsftpd(ftp的服务端),设置好能更新了,但是为什么?后来搜到这篇文章 <Auto Update WordPress Without FTP> 解决了ftp的问题并且意识到上面的问题也和这个有关系,即因为目录的owner不是httpd,所以网站脚本没有对文件操作的权限。
/var/www目录的owner要设置成httpd的运行者(可以用ps aux或者top命令查看),可能是www,apache或者nobody或者其他的。我的是apache,所以在chown apache:apache /var/www -R之后update就不用输ftp了,我立刻关了vsftpd依然ok,可见之前是绕了弯子了,没权限还用ftp操作文件…
绑域名
进godaddy面板直接改A地址就好了,没有别的要操作的。
但是因为我本来虚拟主机上就放了两个网站,所以怎么在一个VPS上绑定多个域名多个网站?之前用cPanel是傻瓜操作,没有怎么弄?这个我也弄了好半天最终解决了,马上再写一篇单独说吧
好啦好啦,到此结束,路人有问题可以在下面留言~
Now adjusting my expectations upward for the topic based on this post, and a stop at exploreinnovativeconcepts continued that bar raising effect, content that resets what I think is possible on a subject is doing real work in shaping my standards and this site is providing those bar raising experiences at a notable rate during sessions.
My usual pattern is to skim and bounce but this site has reset that pattern temporarily, and a stop at voguestraw maintained the slower reading mode, content that changes how I read is content with structural influence and this site has clearly nudged my reading behaviour toward something better at least for the duration of these visits.
Got something practical out of this that I can apply later this week, and a stop at lemonode added more details to think about, this is exactly the kind of content I bookmark for future reference rather than the throwaway listicles that dominate most search results these days for almost any common topic.
Now realising the post solved a small problem I had been carrying for weeks, and a look at tidalurchin extended that problem solving function, content that connects to specific unresolved questions in my own life rather than just providing general interest is content with real practical impact and this site is providing that practical value.
Reading this felt productive in a way most internet reading does not, and a look at brofix continued that productive feeling, sometimes the open web feels like a waste of time but sites like this remind me why I still bother to look around rather than retreating to old reliable sources for everything I need.
Speaking from the perspective of a fairly demanding reader the writing here clears the bar consistently, and a look at syncbyte continued clearing that bar, the calibration of demanding reader is something I apply to all sources and this site has been one of the few that handles the demanding reading well across pieces sampled.
Really grateful for content like this, it does not waste my time and it does not insult my intelligence either, and a quick look at treblevinca was the same, balanced respectful writing that makes a person feel welcome rather than rushed through pages of forced engagement just to keep clicking around.
Now appreciating the small but real way this post improved my afternoon, and a stop at storkumber extended that small improvement effect, content that produces measurable positive impact on the texture of a reading day is content with real value and this site is producing those small positive impacts at a sustainable rate apparently.
Picked this up between two other things I was doing and got drawn in completely, and after imobush my original tasks were completely forgotten for a while, content that derails a workflow in a positive way by being more interesting than what you were already doing is rare and worth recognising clearly.
The examples really helped me grasp the points faster than abstract descriptions would have, and a stop at exploreinnovativeconcepts added a few more practical illustrations that drove the message home, the kind of writing that knows its readers learn better through concrete situations rather than vague generalities is rare and worth recognising clearly.
Reading this confirmed something I had been suspecting about the topic, and a look at jalborn pushed that confirmation toward greater confidence, content that lines up with independently held intuitions earns a special kind of trust and I will return to writers who consistently land that way for me without overselling positions.
Took something from this I did not expect to find, and a stop at tidalurchin added another unexpected useful piece, content that exceeds expectations rather than just meeting them is the kind that builds enthusiasm and earns repeat visits without any explicit ask from the writer or platform behind the work being read.
Glad the writer did not feel the need to argue with imaginary critics in the post itself, and a stop at zulvexa kept the same focused approach going, defensive writing wastes the reader time and confidence on positions that did not need defending and this post has clearly avoided that common failure.
If I am being honest this is the kind of site I quietly hope my own work will someday resemble, and a stop at siskavarsity extended that aspirational feeling, finding work that models what I want to produce is part of why I read carefully and this site has been performing that modelling function for me lately consistently.
Reading this as part of my evening winding down routine fit perfectly, and a stop at halbrook extended the wind down nicely, content that calms rather than agitates is what I want at the end of the day and this site provides that calming reading experience reliably which is increasingly rare across the modern web.
A particular pleasure to read this with a fresh coffee, and a look at sorreltavern extended the pleasure across more pages, content that pairs well with quiet morning rituals is something I have come to value highly and this site has the kind of energy that fits naturally into a calm reading routine.
Reading this prompted a small redirection in something I was working on, and a stop at gongjade extended that redirecting influence, content that affects my actual work rather than just my thinking has the highest practical impact and this site is providing that level of influence for me at a sustainable rate apparently.
Bookmarking this for later, the kind of resource I want to keep nearby, and a quick look at hoxfix confirmed the rest of the site is worth the same treatment, definitely going into my reference folder for the next time the topic comes up at work or in conversation with someone who asks.
Generally I do not leave comments but this post merits a small note, and a stop at tacticstaff extended that comment worthy quality, the urge to actively contribute to a sites community rather than passively consume from it is something specific content provokes and this site has provoked that engagement urge from me today.
Now noticing the careful balance the post struck between confidence and humility, and a stop at fylbust maintained the same balance, finding the line between asserting and admitting is hard and this site has clearly developed the calibration to walk that line consistently which produces a more persuasive reading experience for me.
Easily one of the better explanations I have read on the topic, and a stop at syncbyte pushed it even higher in my mental ranking of useful resources, the kind of site that beats the average not by trying harder but by simply caring more about what it puts out daily which always shows.
Decided not to skim despite my usual habit and was rewarded for the discipline, and a stop at pebblenovel earned the same patient approach, training myself to recognise sites that warrant slower reading is part of being a careful online reader and this site is the kind that helps me practice that skill regularly.
Considered against the flood of similar content this one stands apart in important ways, and a stop at mercymodel extended that distinctive feel, sites that find their own corner of a crowded topic and stay there are sites worth following and this one has clearly carved out its own space and committed to defending it carefully.
The lack of unnecessary jargon made the post accessible without sacrificing accuracy, and a look at seriftackle continued in the same accessible style, technical topics often hide behind specialised vocabulary but here the writer trusts the reader to keep up with plain language and that trust pays off nicely throughout the entire post.
Appreciated that the writer trusted the reader to follow along without constant restating of earlier points, and a look at leveemotel continued that respect for the reader, treating an audience as capable adults rather than as people to be hand held through every paragraph is something I notice and value highly across the open internet today.
Now planning to recommend this site in a context where my recommendations are taken seriously, and a stop at byncane confirmed I should make that recommendation soon, the small but real act of recommending content into spaces where my taste matters is something I take seriously and this site is worth the recommendation.
Came here from another site and ended up exploring much further than I planned, and a look at zulvexa only encouraged more exploration, the kind of place where one click leads to another not through manipulative design but through genuinely interesting content is rare and worth highlighting when found like this somewhere on the open internet.
Looking for similar voices elsewhere has come up empty in my recent searches, and a stop at sorreltavern extended the search frustration, the rare site that does what no other does in quite the same way is precious and this one has clearly developed a particular approach that I have not been able to find duplicates of.
The tone stayed consistent across the whole post which is harder than it looks for longer pieces, and a look at siskavarsity continued the same voice, this kind of editorial consistency is a sign of either a single careful writer or a tightly run team and either is impressive today across the broader media environment.
Liked the way the post got out of its own way, and a stop at timberverge extended that invisible craft, the best writing you barely notice while reading because it is doing its work without drawing attention to itself and this site has clearly mastered that disappearing act across the pieces I have read.
If you scroll past this site without looking carefully you will miss something, and a stop at tacticstaff extended that mild warning, the surface of the site does not advertise its quality loudly which means careful attention is required to recognise what is being offered here which is itself a kind of editorial signal.
Felt the writer respected me as a reader without making a show of doing so, and a look at fylbust continued that quiet respect, this is the kind of small but meaningful detail that separates the sites I bookmark from the ones I close after a single skim and never return to again no matter how interesting the headline.
Thanks for the breakdown, it gave me a clearer picture of something I had been confused about for a while now, and a stop at exploreyourpotential closed the remaining gaps in my understanding nicely, no need to hunt around twenty other articles to put the pieces together which is a real time saver.
Will be passing this along to a few people who would benefit from the perspective shared here, and a stop at velourturban only added to what I will be sharing, this kind of generous content deserves to circulate widely rather than getting buried in some search engine algorithm tweak that pushes it down the rankings.
Looking at this from the perspective of someone tired of generic content the contrast is striking, and a look at jalborn maintained that distinctive feel, sites with strong editorial identity stand out against the bland background of algorithmic content and this one has clearly developed an identity worth recognising through careful attention.
Came away with a small but real shift in perspective on the topic, and a stop at gongjade pushed that shift a bit further, the kind of subtle reframing that good writing does to a reader without making a big deal of it is something I always appreciate when it happens which is sadly not that often.
A handful of memorable phrases from this one I will probably use later, and a look at pebblenovel added a couple more, content that contributes language to my own communication rather than just facts is content with a different kind of utility and this site is providing that linguistic utility consistently across what I read.
Now noticing the careful balance the post struck between confidence and humility, and a stop at steamstraw maintained the same balance, finding the line between asserting and admitting is hard and this site has clearly developed the calibration to walk that line consistently which produces a more persuasive reading experience for me.
Reading this in three sittings because the day was fragmented, and the piece survived the fragmentation, and a stop at tritonsloop held up under similar reading conditions, content engineered for continuous attention is fragile in modern conditions and this site reads as durable across the realistic ways people consume content today.
Good post, the kind that respects the reader by getting to the point quickly without skipping the details that matter, and a short look at seriftackle confirmed that approach is consistent across the site which is rare to find online these days, definitely a place I will return to soon.
Liked the way the post handled the final paragraph, no neat bow but no abrupt cutoff either, and a stop at leveemotel continued that thoughtful ending pattern, endings are hard and most blog writers either over engineer them or skip them entirely and this site has clearly figured out a sustainable middle approach.
Genuine reaction is that this site clicked with how I like to read, and a look at inaarch kept that comfortable fit going, sometimes you find a place online whose editorial decisions just align with your preferences and when that happens it is worth recognising and supporting through repeat engagement consistently going forward.
Reading this prompted me to clean up some old notes related to the topic, and a stop at byncane extended that organising urge, content that triggers personal organisation rather than just consuming attention is content with motivating energy and this site has the kind of clarity that prompts active follow up rather than passive consumption.
The way the post stayed on topic throughout without going on tangents was really refreshing, and a look at suppletoast kept that focused approach going, discipline like this in writing is rare and worth recognising because most writers cannot resist wandering off into related subjects that dilute their main point and confuse readers along the way.
Reading this as part of my evening winding down routine fit perfectly, and a stop at halbrook extended the wind down nicely, content that calms rather than agitates is what I want at the end of the day and this site provides that calming reading experience reliably which is increasingly rare across the modern web.
Decided to set aside time later to read more carefully, and a stop at vistastencil reinforced that decision, content that earns a calendar entry rather than just a passing read is in a different tier altogether and this site is clearly working at that elevated level which I really do appreciate as a reader today.
Reading this on a difficult day was a small bright spot, and a stop at hoxfix extended that brightness, content that improves a hard day is content that has earned a particular kind of place in my reading habits and this site is occupying that uplifting role for me today which I appreciate clearly.
Came in for one specific question and got answers to three I had not even thought to ask, and a look at exploreyourpotential extended that bonus value pattern, the kind of resource that anticipates reader needs rather than just answering the literal question asked is the gold standard and this site reaches it.
Decided to write a short note to the author if there is contact info anywhere, and a stop at mercymodel extended that intention, the urge to thank the writer directly is a strong signal of content quality and this site has triggered that urge in me today which is a fairly rare event for my reading.
Worth recommending broadly to anyone who reads on the topic, and a look at velourturban only confirms that, the rare combination of accessibility and depth in this site makes it suitable for both newcomers and people who already know the area which is hard to pull off in any blog format today and rarely managed.