Archive

Archive for the ‘Linux’ Category

Time Settings on a Dual-Boot Computer

July 17th, 2016 No comments

When dual-booting Windows 7 and Ubuntu 16.04 on a computer, there is conflict in time settings because of the way the two operating systems set the hardware clock. By default Ubuntu uses UTC while Windows uses local time.

So when you shut down the computer, the hardware clock is set to, say, “13:00”. When you reboot, Windows sees “13:00” as local time but Ubuntu sees that as UTC and so converts the time back from UTC to local time. You can fix this by either asking windows to set the hardware clock with UTC, or Ubuntu to use local time.

To make the change in Ubuntu
You can set the hardware clock time standard through the command line. You can check what you have set to use by:

$ timedatectl | grep local

The hardware clock can be queried and set with the timedatectl command. To change the hardware clock time standard to local time, use:

# timedatectl set-local-rtc 1

If you want to revert to the hardware clock being in UTC, do:

# timedatectl set-local-rtc 0
Categories: Linux, Tips and Tricks, Windows Tags:

WordPress Permalinks Apache Setup

June 18th, 2016 No comments

This is a post copied from here. All the credits go to the original author of that post.

Thought I’d include some instructions for setting up “WordPress Permalinks” (which don’t work by default) which means you can get rid of those ugly WordPress URI’s and replace them with something more human readable.

Assuming you have inserted the runtime mod_rewrite DSO or complied Apache with —enable-rewrite then in order to get WordPress permalinks to function you need to include the following in your Apache config file (httpd.conf):

The quoted block below needs to go inside your virtual host section for your WordPress installation. Once Apache has been restarted your permalinks menu inside “Wordpress Admin” can be used and now your new URL’s should be functional.

<Directory "Directory_to_your_Wordpress">
  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
</Directory>
Categories: Linux, Wordpress Tags:

How to Install Apache, MySQL, PHP, and phpMyAdmin on FreeBSD

June 18th, 2016 No comments

This is a post copied from here. All the credits go to the author, iceflatline.

This post will describe how to install and configure Apache, MySQL, PHP and phpMyAdmin on FreeBSD for basic local web development. Once set up, you’ll be able to use your “AMP” server to do web development, code testing, maintain local copies of your web sites, etc.

The software discussed in this post are available as free and open source under various licensing structures. The versions of software discussed in this post are as follows:

FreeBSD 10.3-RELEASE-p4
Virtual Box 5.0.20 r106931
apache24-2.4.20_1
mysql57-server-5.7.12_1
mod_php70-7.0.7
php70-7.0.7
php70-extensions-1.1
phpMyAdmin-4.6.2
WordPress 4.5.2

The following steps discussed in this post assume you have the FreeBSD Ports Collection installed. If not, you can install it using the following commands:

portsnap fetch
portsnap extract

If the Ports Collection is already installed, make sure to update it:

portsnap fetch update

Okay, let’s get started. All commands are issued as the root user or by simulating the root user by using the command su. While building the various ports you should accept all default configuration options unless otherwise instructed.

Install Apache

Navigate to the Apache server port and build it:

cd /usr/ports/www/apache24
make config-recursive install distclean

Once Apache has been successfully installed, add the following line to /etc/rc.conf so that the Apache server will start automatically at system boot.

sysrc apache24_enable=YES

Now let’s start Apache to make sure it works:

service apache24 start

Point your web browser to the host name or IP address of the FreeBSD host you’ve installed Apache on and you should see the venerable “It works!”

Install MySQL

Now let’s build the MySQL server:

cd /usr/ports/databases/mysql57-server
make config-recursive install distclean

Add the following line to /etc/rc.conf:

sysrc mysql_enable=YES

And start the mysql server:

service mysql-server start

Then set a password for the MySQL root user:

/usr/local/bin/mysql -u root -p

You’ll be requested to enter a password. Enter the password contained in /root/.mysql_secret. You’ll now be at the command prompt for the mysql server. Change your password using the following command:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'your-new-password';

Enter ‘quit’ to exit the server. You may now delete /root/.mysql_secret.

Install PHP

Next, we’ll build PHP:

cd /usr/ports/lang/php70
make config-recursive install distclean

Then the module required to support PHP applications on Apache:

cd /usr/ports/www/mod_php70
make config-recursive install distclean

Now let’s add the extensions to PHP to round out its capabilities. Before we build this port though we’ll want to add support for MySQLi (an improved interface to MySQL) in order to communicate with the MySQL server.

cd /usr/ports/lang/php70-extensions/
make config-recursive

In the corresponding menu you should select “MYSQLI”, then proceed with building the port:

make install distclean

Install phpMyAdmin

phpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL from your web browser. phpMyAdmin supports a wide range of operations with MySQL, including managing databases, tables, fields, relations, indexes, users, permissions, etc., from an easy-to-use web page, while you still have the ability to directly execute any SQL statement from the command line if you prefer. Installing phpMyAdmin is optional but it’s nice tool to have:

cd /usr/ports/databases/phpmyadmin/
make config-recursive install distclean

Configuration

Now that we have the requisite ports built and installed it’s time to configure them. First, let’s create the file /usr/local/etc/php.ini to hold our PHP options. The simpliest way to do this is to copy the file /usr/local/etc/php.ini-development which will add the default settings for new PHP installations. This configuration is suitable for development purposes, but NOT necessarily for production purposes. If your plans include a production server, then among other things, and before going online with your site, you should consider copying /usr/local/etc/php.ini-production instead and consult the recommendations at http://php.net/manual/en/security.php.

cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini

Now let’s configure Apache. Open the file /usr/local/etc/apache24/httpd.conf and look for the following line:

DirectoryIndex index.html

And change it so it reads as follows:

DirectoryIndex index.html index.php

Then append the following lines to the end of the file in order to support PHP files as well as phpMyAdmin, which normally lives outside of the Apache document root. Note: if you elected not to install phpMyAdmin, then you need only add the FilesMatch directives.

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
 
Alias /phpmyadmin "/usr/local/www/phpMyAdmin"
 
<Directory "/usr/local/www/phpMyAdmin">
Options None
AllowOverride None
Require all granted
</Directory>

Now restart Apache:

service apache24 restart

That’s it for our Apache configuration. Now let’s configure phpMyAdmin. We’ll do this by creating the file /usr/local/www/phpMyAdmin/config.inc.php, the basic configuration file for phpMyAdmin. Traditionally, users have manually created or modified /usr/local/www/phpMyAdmin/config.inc.php, but now phpMyAdmin includes a nice setup script, making it much easier to create this file with the settings you want. Start by creating the directory /usr/local/www/phpMyAdmin/config and make it writable by the phpMyAdmin setup script:

mkdir /usr/local/www/phpMyAdmin/config && chmod o+w /usr/local/www/phpMyAdmin/config

Then make /usr/local/www/phpMyAdmin/config.inc.php readable by the phpMyAdmin setup script:

chmod o+r /usr/local/www/phpMyAdmin/config.inc.php

Now open your web browser and navigate to http://your-hostname-or-IP-address/phpmyadmin/setup where you will see the phpMyAdmin setup Overview page. Select “New server” and then select the “Authentication” tab. Under the “Authentication type” choose “http” from the drop-down list (using HTTP-Auth to sign-in into phpMyAdmin will avoid storing login/password credentials directly in config.inc.php) and remove “root” from the “User for config auth”(See Figure 1).

phpMyAdmin setup page
Figure 1. Screenshot of the phpMyAdmin setup page.

Now select “Apply” and you will be returned you to the Overview page where you should see a new server listed. Select “Save” in the Overview page to save your configuration as /usr/local/www/phpMyAdmin/config/config.inc.php. Now let’s move that file up one directory to /usr/local/www/phpMyAdmin where phpMyAdmin can make use of it.

mv /usr/local/www/phpMyAdmin/config/config.inc.php /usr/local/www/phpMyAdmin

Now let’s try out phpMyAdmin to make sure it works. Point your web browser to http://your-hostname-or-IP-address/phpmyadmin where you will be presented with a pop-up box requesting you to log in. Use “root” and the MySQL password you set up previously, then you should be directed to the phpMyAdmin administration page. We no longer need the /usr/local/www/phpMyAdmin/config directory so let’s remove it, as well as the read permission we added previously to /usr/local/www/phpMyAdmin/config.inc.php:

rm -r /usr/local/www/phpMyAdmin/config
chmod o-r /usr/local/www/phpMyAdmin/config.inc.php

And wrap up by restarting the Apache and MySQL servers:

service apache24 restart
service mysql-server restart

Testing our installation using WordPress

WordPress is a full-featured website/blog platform that makes heavy use of Apache, MySQL and PHP. We’ll install it on our newly created implementation to ensure we have these packages installed and working correctly. Once again, all commands are issued as the root user or by simulating the root user using the command su. Let’s start by downloading the latest WordPress directly from the developers site to your home directory and untarring the package:

cd ~
fetch http://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz

You should now see the new directory wordpress in your home directory. Next we need to create the file ~/wordpress/wp-config.php and make some changes to it so WordPress can access the MySQL server. First, let’s copy the file ~/wordpress/wp-config-sample.php to use as a template:

cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php

Open ~/wordpress/wp-config.php in your favorite editor and enter the database name as well as your MySQL login and password in the appropriate lines. When complete, it should look like the following:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
 
/** MySQL database username */
define('DB_USER', 'root');
 
/** MySQL database password */
define('DB_PASSWORD', 'your-mysql-password');

Now move the wordpress directory to Apache’s document root:

mv ~/wordpress/ /usr/local/www/apache24/data/

Next, let’s create an MySQL database for our WordPress installation. Open phpMyAdmin in your browser and create a database by selecting the “Databases” tab at the top. Enter a name for it in the “Create database” field. For purposes of our example, I’ll use “wordpress” as the database name. You’re free to use a different database name, just make sure to use the same name in the define(‘DB_NAME’, ‘your-DB-name’); line in ~/wordpress/wp-config.php as described above. Then select “Create.”

Now let’s run the WordPress script that will populate its database with the requisite tables. Open your web browser and navigate to http://your-hostname-or-IP-address/wordpress/wp-admin/install.php. If everything is configured correctly you should see the WordPress installation wizard page (See Figure 2). Enter a title for your site, username, password, and an e-mail, then select “Install WordPress.” Then login with your newly created WordPress credentials and you should be presented with the default WordPress administration page.

WordPress installation page
Figure 2. Screenshot of WordPress installation page.

Common problems

An error that occasionally pops up when attempting to start the Apache server is the following:

httpd: apr_sockaddr_info_get() failed for <some-host-name>
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
/usr/local/etc/rc.d/apache24: WARNING: failed to start apache24

This can be fixed by adding the following line to /usr/local/etc/apache24/httpd.conf:

ServerName localhost:80

HTTP 403 permission problems when trying to access phpMyAdmin is another area that seems to sometimes trip people up. This is usually caused by errors in the way either the Alias or Directory Apache directives for phpMyAdmin have been written in /usr/local/etc/apache24/httpd.conf. As an example, a missing “/” in the Alias statement cost me two hours of troubleshooting time!

Conclusion

Well, that’s it. A few hours of your time with the FreeBSD Ports Collection and you can a get a fully configured “FAMP” web development server up and running on your FreeBSD box.

Categories: Linux, Wordpress Tags:

Debian – Some Upgrades Show Packages Being Kept Back

December 13th, 2012 No comments

This is a post copied from here. All the credits go to the author, Steve.

Sometimes when you go to upgrade your machine with apt-get you will see that a package is being “kept back”.

Normally to upgrade a machine you would run:

apt-get update
apt-get upgrade

This should upgrade all the installed packages upon your machine (well at least all those packages which you have installed that have a newer version available), but it doesn’t always do that.

If the dependencies have changed on one of the packages you have installed so that a new package must be installed to perform the upgrade then that will be listed as “kept-back”.

For example my apt-get upgrade today showed this:

root@sun:~# apt-get upgrade
Building Dependency Tree... Done
The following packages have been kept back:
  bind9-host dnsutils imagemagick libmagick6
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

There we can see four packages haven’t been upgraded, even though newer packages are available. This is because two new packages were introduced, and these upgrades depend upon it.

To fix this you must run :

apt-get dist-upgrade

This will upgrade the packages that have newer versions available, and install any new dependencies which are required to do that.

root@sun:~# apt-get dist-upgrade 
Reading Package Lists... Done
Building Dependency Tree... Done
Calculating Upgrade... Done
The following NEW packages will be installed:
  libdns16 libdps1
The following packages will be upgraded:
  bind9-host dnsutils imagemagick libmagick6
4 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 3697kB of archives.
After unpacking 1860kB of additional disk space will be used.
Do you want to continue? [Y/n]

Here we can see the two new packages which are required to satisfy the dependencies of the upgrades, libdns16 and libdps1.

Categories: Linux, Tips and Tricks Tags:

Logitech Performance MX Mouse under Xubuntu

November 15th, 2012 No comments

If you Logitech Performance MX Mouse doesn’t work out of box under Xubuntu, there is an easy fix.

Edit the file: /lib/udev/rules.d/97-bluetooth-hid2hci.rules. Change this line:

    # Logitech devices
    KERNEL=="hiddev*", ATTRS{idVendor} =="046d" , ATTRS{idProduct }=="c70[ 345abce] |c71[34bc] ", \
    RUN+="hid2hci --method= logitech- hid --devpath=%p"

to

    # Logitech devices
    KERNEL=="hidraw*", ATTRS{idVendor} =="046d" , ATTRS{idProduct }=="c70[ 345abce] |c71[34bc] ", \
    RUN+="hid2hci --method= logitech- hid --devpath=%p"

Note that you only need to change “hiddev*” to “hidraw*“.

Restart the machine and your Performance MX Mouse should work now.

Categories: Linux, Tips and Tricks Tags:

Restore Grub 2 Using LiveCD

October 21st, 2012 No comments

Restore Grub 2 Using LiveCD
Grub 2 typically gets overridden when you install Windows or another operating system. To make Grub 2 control the boot process, you need to reinstall (repair/restore) Grub 2 using a Ubuntu live CD.

Boot the computer using live CD. Open the Terminal. Using the following commands to mount the partition your Ubuntu Installation is on. If you are not sure which it is, launch GParted (included in the Live CD) and find out. Replace the XY in the command with your drive letter and partition number.

sudo mount /dev/sdXY /mnt
sudo mount --bind /proc /mnt/proc
sudo mount --bind /dev /mnt/dev
sudo mount --bind /sys /mnt/sys

Now you need to change root using chroot command.

sudo chroot /mnt

Now install and Grub 2. This time you only need to add the partition letter (no number) to replace X.

grub-install /dev/sdX
grub-install --recheck /dev/sdX

Now you can exit you mounted hard disk and unmount.

exit
sudo umount /mnt/sys
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt

Shut down and turn your computer back on, and you will be met with the default Grub2 screen. You may want to update or re-configure Grub 2 using the method mentioned in Grub 2 Configuration to the way you like it.

Reference
How to Repair/Restore/Reinstall Grub 2 with a Ubuntu Live CD.

Categories: Linux Tags:

Grub 2 Configuration

October 14th, 2012 No comments

Grub 2 Configuration
Grub 2 的配置文件是位于 /boot/grub/ 目录下的 grub.cfg。与 Grub Legacy 不同的是,这个 grub.cfg 文件是不建议手动修改的。它是在安装或者更新 Grub 2 的时候自动生成的。如果要修改或者定制 grub.cfg 文件,则需要在两个地方进行修改,然后重新运行 grubmkconfig 的命令来生成新的 grub.cfg 文件。

两处需要修改的地方分别是: 1) /etc/default/ 目录下的 grub 文件和 2) /etc/grub.d/ 目录下的若干文件。

/etc/default/grub
先说一下 /etc/default/grub 文件。用文本编辑器打开这个文件,会看到如下相似的内容:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
 
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
# GRUB_INIT_TUNE="480 440 1"

在这里解释一下该文件里几个常用的命令。

GRUB_DEFAULT=0

这个命令指定缺省的可引导的操作系统。数字“0”表示在操作系统列表中的第一个操作系统将是缺省引导的操作系统。如果你想要把列表中的第四个操作系统作为缺省引导的系统,就把“0”改成“3”。剩下的以此类推。

#GRUB_HIDDEN_TIMEOUT=0

这个命令控制是否在计算机启动时显示操作系统列表。如果把“#”号去掉的话,在计算机启动的时候就不会显示可引导操作系统的列表。

GRUB_TIMEOUT=10

这个命令设置在计算机启动时 Grub2 在引导缺省操作系统前等待的时间(以秒为单位)。在这个时间里用户可以用键盘方向键选择不同的操作系统来进行引导。

GRUB_HIDDEN_TIMEOUT_QUIET=true

这个命令控制是否在计算机启动是显示时间倒计时(即用户还有多少时间进行选择)。如果设置为“true”则不会显示时间倒计时,如果设置为“false”则会显示时间倒计时。

/etc/grub.d/ 目录下的文件
再说一下 /etc/grub.d/ 目录下的几个文件。这些文件都是可执行文件,它们的命名方式为: nn_xxxxxx,其中 nn 是两位数的整数,xxxxxx 是任意字母、数字和有效字符的组合,如下所示:

00_header
05_debian_theme
10_linux
20_memtest
30_os-prober
40_custom

在更新 Grub 2 的时候,这些文件会按照 nn 从小到大的顺序被先后执行,执行的结果被写入 grub.cfg 文件。需要说明的一点就是 grub.cfg 里的可引导操作系统是按照这些文件被执行的先后顺序来写入文件的。如果你想把自己常用的操作系统放在列表最上面的话就需要自己建一个文件,文件名和上面提到的文件名类似,不过 nn 需要介于 “05” 和 “10” 之间,比如说可以命名为 06_custom。然后我们就可以编辑这个 06_custom 文件来让 Grub 2 加入我们自己的操作系统。

下面以加入引导 Windows 7 为例来说明如何编辑 06_custom 文件。Windows 7 用的是 chainloader type boot entry。下面的代码会在更新 Grub 2 的时候在列表最上面加入一个 “Windows 7” 的引导项。

#! /bin/sh -e
echo "Adding custom boot entry(s)" >&2
cat << EOF
menuentry "Windows 7" {
    set root=(hd0,1)
    chainloader +1   
}
EOF

需要注意的是下面这个命令:

set root=(hd0,1)

(hd0,1) 指的是安装了 Windows 7 的硬盘和分区。这个信息一定要正确,不然的话 Grub 2 引导 Windows 7 的时候会出错。这个信息可以在 Linux 下面用 fdisk -l 命令找出来。

编辑完 06_custom 文件后还需要把它变成可执行文件:

chmod 755 06_custom

如果需要删除 Grub 2 引导列表中的项目,则只需要简单地把 nn_xxxxxx 文件的可执行属性去掉。例如我们不想生成 memtest 项目,用下面的命令把 20_memtest 变成不可执行就行了:

chmod -x 20_memtest

生成新的 /boot/grub/grub.cfg 文件
在修改完上面提到的 /etc/default/grub 文件和 /etc/grub.d/ 下面的文件后,可以用下面这个命令来生成新的 grub.cfg 文件:

grub-mkconfig -o /boot/grub/grub.cfg

Reference
GRUB2 Configuration.

Categories: Linux Tags:

解决ubuntu注销后黑屏的问题

July 24th, 2011 No comments

刚在我的台式机电脑上安装了 Ubuntu 11.04,发现注销用户之后出现黑屏,什么都看不到,只能 Ctrl+Alt+F1 进入另一个 text terminal 重启解决。百度之后找到了这篇博文:解决ubuntu注销后黑屏的问题。里面的方法解决了这个问题,现转载如下:

我用的系统是kubuntu10.04,注销后黑屏,无法进行任何操作,只能强行关机,在网上苦苦寻找答案。

方法1: 在启动项的kernel后面,把 splash 和 quiet 删除,方法可行,但无开机动画,否决。

方法2: 安装gdm,方法可行,但gdm的界面和漂亮的kde很不协调,否决。

方法3: 修改/etc/kde4/kdm/kdmrc文件,将参数 TerminateServer=true 前面的注释去掉,经反复测试,问题解决!

Categories: Linux Tags:

Ubuntu 10.10 and MythTV 0.24

December 10th, 2010 No comments

这个小项目的目的是在 Ubuntu 10.10 上面安装 MythTV 0.24。

简介
Ubuntu 是目前比较流行的 linux 发行版本。相对于其它 linux 发行版本,Ubuntu 的安装方便,使用简单,并且集成的软件包都比较新 (详情请看 Ubuntu 的官方网站)。当前 Ubuntu 的最新版本是 10.10。

MythTV 是一个基于 linux 的开源数码录影软件。使用 MythTV 能够把你的电脑转换成一台家庭娱乐系统。MythTV 有很多特点,包括观看和录制电视,时移电视 (类似LG的左右时间),看DVD,听音乐,看图片,甚至可以上网,订购RSS等。另外,用户可以加入第三方或者自己开发的插件来增加自己的需求 (详情请看 MythTV 的官方网站)。当前 MythTV 的最新版本是 0.24。

先介绍一下我的电脑的硬件配置。

硬件

  • CPU: AMD Opteron 165 1.8GHz Dual-Core Processor
  • GPU: eVGA Nvidia GeForce 7900 GTO
  • TV Tuner Card: Hauppauge WinTV-HVR-1600
  • Memory: GSkill DDR400 2x1GB
  • Hard Drives: Western Digital 250GB x2

硬件列表里面最关键的就是显卡和电视卡了,后面关于 MythTV 的一些配置步骤都是跟它们有关。

安装步骤

  1. 安装 Ubuntu
  2. 这一步没有什么好说的,无非是从 Ubuntu 网站上下载镜像文件,刻盘,用光盘启动,给硬盘分区,然后安装。但是需要提一下的是在安装进行到大约 93% 的时候,Ubuntu 的安装程序报错说无法安装 bootloader 到硬盘主引导扇区。我 google 了一下,这个问题是 Ubuntu 比较常见的 bug。解决的方法就是在弹出的对话框里选择 “Proceed without installing bootloader”,安装完成后再次用 Ubuntu Live CD 启动计算机,然后按照 Reinstalling Grub 2 里面的步骤重新安装 Grub2 到硬盘主引导扇区。

  3. 更新 Ubuntu
  4. 第一次运行 Ubuntu,需要对其进行更新。所有更新中最重要的是需要将 linux kernel 的版本从 2.6.35-22-generic 升级到 2.6.35-23-generic。原因是最新的 Hauppauge HVR-1600 驱动程序只能在新的 kernel 里编译通过。

    更新 Ubuntu 很简单。打开一个命令窗口 (Terminal),在里面输入如下命令:

    sudo apt-get update
    sudo apt-get upgrade

    Ubuntu 就会自动更新软件包,其中包括把 linux kernel 升级到最新的 2.6.35-23-generic。

  5. 安装 Nvidia 的驱动程序
  6. 这一步是安装显卡程序。在命令窗口里输入:

    sudo apt-get install nvidia-current

    Nvidia 的最新驱动程序就会自动安装。安装完之后重新启动计算机,然后在命令窗口运行

    sudo nvidia-xconfig

    来进行 X11 的自动配置。

    在这一步需要特别提到的一点就是:如果你的系统里用的是 Nvidia 的显卡和 Hauppauge HVR-1600 电视卡,那么需要更改 Grub 2 的配置文件来防止一个 bug。由于很不幸的我正好使用的是这两块卡,所以我也需要做这额外的一步。用一个文本编辑器打开 /boot/grub/grub.cfg,并在 kernel 那一行的末尾加上:

    vmalloc=256M

    改过之后 kernel 那行应该是这样的

    kernel ...... vmalloc=256M
  7. 安装 KDE
  8. Ubuntu 默认安装的 Gnome 系统。我个人比较喜欢 KDE 桌面系统,所以这一步是安装 KDE。同样的,在命令窗口里输入:

    sudo apt-get install kde-full
  9. 设置 KDE 字体
  10. 这一步不是必需的。不过我觉得 KDE 默认的字体太小,看起来费眼,于是在 System Settings -> Application Appearnce 里面将字体改大了。

  11. 安装 ncurses 运行库
  12. 这个 ncurses 运行库是编译 CX18 驱动程序时必需的。

    sudo apt-get install libncurses5-devel
  13. 安装 Hauppauge HVR-1600 的驱动程序 (CX18)
  14. MythTV 的 Wiki 上有一篇 关于 Hauppauge HVR-1600 的文章。Hauppauge HVR-1600 是基于 CX23418 的电视卡,使用 CX18 驱动程序。

    • 下载源文件
    • v4l-dvb 网站 上下载最新的驱动程序源文件。我下载的文件是 v4l-dvb-abd3aac6644e.tar.gz。

    • 解压缩
    • tar zxvf v4l-dvb-abd3aac6644e.tar.gz
    • 生成和修改配置文件
    • 进入刚才解压缩生成的 v4l-dvb-abd3aac6644e 目录,然后输入以下命令:

      sudo make menuconfig

      不需要修改任何选项直接点击 “Exit” 退出,然后点 “Yes” 保存配置 (这步会自动生成配置文件)。

      下面需要修改 v4l 目录下的 .config 文件以避免一个编译错误。进入 v4l 目录用文本编辑器打开 .config 文件。将这一行

      CONFIG_DVB_FIREDTV=m

      改为

      CONFIG_DVB_FIREDTV=n
    • 编译
    • make

      这一步需要的时间比较长,请耐心等待。

    • 安装驱动程序
    • make install
    • 激活驱动
    • sudo modprobe cx18
  15. 安装 MythTV
  16. 安装 MythTV 很简单。在命令窗口输入以下命令:

    sudo apt-get update
    sudo apt-get install mythtv

    Ubuntu 就会自动安装最新的 MythTV 以及运行 MythTV 需要的其它软件和运行库。这一步需要花好几分钟。在安装过程中会弹出几个对话框向用户询问一些选项,包括:

    • 第一个对话框要求用户输入一个 MySQL 数据库 root 用户的密码;
    • 第二个对话框询问是否允许其它的计算机远程连接到本机的 MythTV 服务器。如果本机是置于一个防火墙之后,建议选择 “Yes”。
    • 安装程序会自动生成一个 MySQL 用户和密码,这些信息保存在 /etc/mythtv/mysql.txt 这个文件中。在下一步 “配置 MythTV” 中会用到这些信息。
  17. 配置 MythTV
  18. 在命令窗口中输入以下命令来配置 MythTV:

    mythv-setup

    配置 MythTV 不是一个简单的任务,不过网上有很多教程和文章。我推荐 MythTV 的 官方文档 以及 MythTV Ubuntu Installation Guide

Categories: Linux, Projects Tags: ,

Ubuntu Fix: Firefox 3.6.4pre Freeze

April 14th, 2010 No comments

After upgrading from Firefox 3.5 to Firefox 3.6.4pre, I got this annoying problem: Whenever I opened a page with flash, Firefox greyed out and freezed. Fortunately, there are many smart people out there. I found this fix from Ubuntu Forum.

Basically, it’s what I suspected all along. Firefox developers have started to add the code for process isolation to Namoroka 3.6.4 but it’s not working properly yet.

Since version 3.6.2, I’ve observed that Firefox on Linux now has 2 processes while running – firefox and firefox-bin. Today, however, I noticed that since the update, whenever a site with flash components is loaded, a third firefox-bin process is loaded, presumably to contain and isolate the flash data. Whenever this process loads,however, the browser freezes.

I was able to find out which settings in about:config control the flash isolation behavior. Here goes:

Type about:config in the address bar
In the filter pane, type ipc

The filter should produce the following four config lines –

dom.ipc.plugins.enabled;false
dom.ipc.plugins.enabled.libflashplayer.so;true
dom.ipc.plugins.enabled.libnptest.so;true
dom.ipc.plugins.timeoutSecs;10

To turn off the flash process isolation, change the second line (libflashplayer.so) to false and restart the browser. Then re-enable flash and the browser should be able to load flash pages and play flash video as usual.

Categories: Linux, Tips and Tricks Tags: