Wifi Setup under Archlinux

Number of View: 343

实验室有wifi,上次以为是wep加密,结果弄了半天都invalid arguments,这次仔细看了下原来是WPA,参照ArchWiki搞定。
1. Check wpa_supplicant

# wpa_supplicant
...
drivers:
  wext = Linux wireless extensions (generic)
  nl80211 = Linux nl80211/cfg80211
  wired = wpa_supplicant wired Ethernet driver

2. Configure WPA with ssid(here mywireless) and key(here secretpassphrase)

# mv /etc/wpa_supplicant.conf /etc/wpa_supplicant.conf.original
# wpa_passphrase mywireless "secretpassphrase" > /etc/wpa_supplicant.conf
# vim /etc/wpa_supplicant.conf
network={
        ssid="mywireless"
        #psk="secretpassphrase"
        psk=****************************
}

Add this line to the conf file

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

3. Start WLAN

# ifconfig wlan0 up
# iwconfig wlan0 essid mywireless
# wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf
# dhcpcd wlan0

4. Check wlan0

# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 00:22:FA:5F:7F:66
          inet addr:192.168.1.122  Bcast:255.255.255.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:576  Metric:1
          RX packets:73529 errors:0 dropped:0 overruns:0 frame:0
          TX packets:59186 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:39228330 (37.4 Mb)  TX bytes:6663024 (6.3 Mb)

然后ping外面ping不通,发现是从eth0 ping出去的,执行/etc/rc.d/network stop把eth0上的网络关掉就可以了.

@————————————————我是泪的分割线—————————————@

SteamedFish童鞋的教导下,我学习了netcfg的用法,深深地认识到了自己的错误。。。。

1. 创建netcfg profile

# cp /etc/network.d/examples/wireless-wpa /etc/network.d/
# vim /etc/network.d
CONNECTION='wireless'
DESCRIPTION='A simple WPA encrypted wireless connection'
INTERFACE='wlan0'
SECURITY='wpa'
ESSID='mywireless'
KEY='secretpassphrase'
IP='dhcp'
# move /etc/network.d/wireless-wpa /etc/network.d/[profilename]

2. Start network

# netcfg [profilename]
  • Share/Bookmark

Install MoinMoin under ArchLinux

Number of View: 382

MoinMoin is a Python WikiClone, based on PikiPiki. To install it on ArchLinux and run it with apache httpd, follow these steps:

  1. Install MoinMoin and dependencies:
    $ pacman -S moinmoin mod_python
  2. Look into the SHARE directory, usually /usr/share/moin – this is where the templates are located
    • data directory (wiki pages, users, etc.) – only MoinMoin should access this
    • underlay directory (wiki pages) – only MoinMoin should access this
    • htdocs directory with html support files – the web server will need to access this
    • server – MoinMoin example startup files (like moin.cgi for CGI)
    • config – MoinMoin example configuration files (like wikiconfig.py)
  3. Choose a wiki name (Here I choose the default ‘mywiki’) and create a directory for the wiki
     $ mkdir /home/http/mywiki
  4. Copy the files.
    $ cp -R /usr/share/moin/data /home/http/mywiki
    $ cp -R /usr/share/moin/underlay /home/http/mywiki
    $ cp /usr/share/moin/config/wikiconfig.py /home/http/mywiki
  5. Install moin.cgi
    $ mkdir /home/http/mywiki/cgi-bin
    $ cp /usr/share/moin/server/moin.cgi /home/http/mywiki/cgi-bin/
  6. Change permissions
    $ chown -R http:http /home/http/mywiki
    $ chmod -R ug+rwX /home/http/mywiki/
    $ chmod -R o-rwx /home/http/mywiki
  7. Configure moin.cgi: insert this line after the import sentences
    sys.path.insert(0, '..')
  8. Configure Apache.
    $ vim /etc/httpd/conf/httpd.conf

    First, load the mod_python module

    LoadModule python_module /usr/lib/httpd/modules/mod_python.so

    Next, setup Alias and ScriptAlias

    Alias /wiki/ "/usr/share/moin/htdocs/"
    ScriptAlias /mywiki "/home/http/mywiki/cgi-bin/moin.cgi"

    Finally, setup access permissions.

     <Directory /usr/share/moin/htdocs>
        Order deny,allow
        Allow from all
    </Directory>
  9. Configure MoinMoin
    $ vim /home/http/mywiki/wikiconfig.py
    

    Modify these parameters.

    data_dir = '../data/'
    data_underlay_dir = '../underlay/'
    url_prefix = '/wiki'
    

    Uncomment this line.

     url_prefix_static = '/mywiki' + url_prefix_static
    
  10. Restart the apache server
    $ /etc/rc.d/httpd restart
    or
    $ apachectl restart
    
  11. Test the wiki
    Start the browser and access the URL http://127.0.0.1/mywiki/



References

  • Share/Bookmark