ubuntu 安装过程中相关问题<不断更新>

1.Ubuntu 开机或者安装时候出现花屏现象

A:由于驱动没有安装或存在问题,会导致花屏死机,无法进入系统。解决办法之一:开机进入启动菜单,(可能需要按F6)在选择启动项界面的时候,按e编辑启动命令,找到下面一行上有:quite splash , 后面加上 nomodeset 然后按F10或者ctrl + x 启动系统,这时候可以顺利启动。然后进入系统之中更新驱动,之后便可以正常启动不花屏了。


2.无法下载 bzip2:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages  Hash 校验和不符

A:很有可能是更新到一半出错了,所以是W: 无法下载 gzip:/var/lib/apt/lists/partial/cn.archive.ubuntu.com_ubuntu_dists_natty-updates_main_source_Sources Hash 校验和不符。试试把/var/lib/apt/lists/partial/里的东西全删了,再sudo apt-get update。如果不行,再换源试试。

       sudo rm -f /var/lib/apt/lists/partial/*


3.vi

来自http://tunps.com/gvim-vimrc-active-without-restarting

在启动加载的任意一个vim脚本中(一般都是_vim)加入下面一行代码:autocmd! bufwritepost  .vimrc source % ,便可以不需要重启就使用新的


常用插件:

https://github.com/tpope/vim-pathogen 自动管理插件的插件。

https://github.com/vim-scripts/SyntaxComplete 语法补全

https://github.com/vim-scripts/SuperTab tab补全

https://github.com/fishman/ctags 这个需要安装。make安装。详见:http://blog.sina.com.cn/s/blog_684355870100jqz3.html

自动括号配对:http://oldj.net/article/vim-parenthesis/



4. php发送邮件:

在搜索了很多国内博客,发觉都是出自一篇,而且记录十分简略,对于刚用linux下的邮件服务的我,完全不可行的情况下,我google外文博客,终于从老外那找到了非常好用的教程,在此不得不感叹别人的认真程度。同时也记录下来,以备今后使用:

原文地址:http://www.sunfinedata.com/handson/software-handson/postfix-gmail-smtp-server-relay-under-ubuntu-os/

Postfix + Gmail SMTP server relay under Ubuntu OS

In order to preserve the useful information, I took information from the internet and posted here. The method was verified and works well for my situation.

I realize that there are too many tutorials on getting your Relaying Postfix SMTP via smtp.gmail.com to work. Most of them are long and complicated, but I found a tutorial from this particular website which provides the shortest, simplest, and the clearest tutorial on how to get it work in less than 5 minutes. I would like to post it here for my future use again, so that I don’t need to spend hours finding the right tutorial to get it done :)

Install the required packages
sudo aptitude install postfix libsasl2 ca-certificate libsasl2-modules

 sudo cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf 

Configure Postfix
This tutorial will not outline how to configure your postfix server, but we’ll jump directly to the relayhost section. You’ll want to add the following lines to your /etc/postfix/main.cf file:

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

The above lines are telling Postfix that you want to relay mail through gmail on a specific port, telling it to authenticate, and where to find the username and password. The last three lines specify the authentication types supported, where the certificate authority file is and that it should use tls.

Define Username and Password
Next we’ll need to populate the sasl_passwd file. Create the file /etc/postfix/sasl_passwd with the following contents:

[smtp.gmail.com]:587 user.name@gmail.com:password

This file should have restrictive permissions and then needs to be translated into a .db that Postfix will read.

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd

At this point you can restart Postfix and it should work, however it will complain about not being able to authenticate the certificate. To take care of this issue we’ll use the ca-certificate package we installed and tell it where it can validate the certificate.

cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

Go ahead and reload postfix (sudo /etc/init.d/postfix reload) and you should be set.

Taken from http://blog.jonloh.net/11/04/2010/postfix-gmail-smtp-relay-ubuntu.

Additional materials:
1) Warning message – No address associated with hostname
If the mail relayhost is wrong, you will get a lot of warning message in /var/log/mail.warn with the “No address associated with hostname”. That indicates you have to put a valid smtp relay mail server in the config file. Otherwise all your mail will be stuck in somewhere without your notice.

2) Warning message – no route to host in the mail.log
I checked mail.log and found “no route to host” after I put gmail smtp as the mail relay server. The reason I got this was I did not get the TLS authentication correctly. After I corrected it, everything goes smoothly without error.

3) Error message – 530 5.7.0 Must issue a STARTTLS command first
This message actually came from the gmail smtp server. It tells you something is not right. Actually it is the same problem as the point 2). Gmail smtp server needs TLS authentication.

在安装完postfix之后,可以使用命令

echo 邮件内容 | mail -s 邮件标题 邮件地址@somewhere.com

测试是否能发送邮件。


注意查看是否启动了postfix服务。


另外要用php的mail函数发送邮件,就需要设置好php.ini文件:

php.ini

1 ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
3 sendmail_path = "/usr/sbin/sendmail -t -i"

注意:我在运行php mail函数的时候会显示 sh:1 -t 之类,大概是找不到这个脚本。苦苦思索之下,打开phpinfo(),查看各项设置,发觉我的php.ini并没有放在apache的指定目录,于是建立软链过去,终于是生效了。到此,测试发送邮件成功。一切大功告成了~

relayhost = [smtp.qq.com]:25
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous

在/etc/postfix/sasl_passwd里输入如下信息

[smtp.qq.com]:25   qq邮箱地址:密码

然后执行postmap /etc/postfix/sasl_passwd

再重启postfix即可

注意,如果发邮件的话,from一定要设置的跟passwd里的邮箱地址一致,否则会被腾讯拒掉


From设置:

Instructions

    • 1

      Configure address rewriting through local files; this is the easiest method, although databases can also be used. Once Postfix is properly installed, enable "generic mapping" for outgoing mail. Open the main Postfix configuration file, "main.cf," which can usually be found in "/etc/postfix."

    • 2

      Locate the directive line that reads "smtp_generic_maps." If it is not present in the file, add it at the bottom of the file. Set the directive equal to the location of a new file you will create to contain mappings from internal addresses to the proper external address. For example:

      smtp_generic_maps = hash:/etc/postfix/generic

    • 3

      Create a text file with the same name and location that you specified in Step 2. This file will contain a tab-separated list of internal addresses mapped to the address you want in the "From" line in sent mail. For example:

      some-address@localhost correct-address@your-domain.com

      another-address@some-server different-address@your-domain.com

      This will automatically change the "From" line for mail sent from addresses on the left to the address on the right.

    • 4

      Restart the Postfix server once you have finished editing configuration files.



Read more: How to Set Postfix From an Address | eHow.com http://www.ehow.com/how_8029284_set-postfix-address.html#ixzz2DdM7IX4x



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值