修改swap分区

linux(ubuntu)下修改swap大小

第一步:查看内存空间大小

free -m //m表示显示的字节单位是m(megabytes)

第二步:删除已有交换分区

cd /dev
sudo swapoff sda7 //sda7是通过gparted查看swap分区
sudo rm sda7

第三步:创建新的交换分区

sudo mkdir /swap
cd /swap
sudo dd if=/dev/zero of=swap.disk bs=1M count=3k(3k表示swap分区的大小为3G,如何设置为2G的话,则count=2k)
sudo mkswap -f swap.disk
sudo swapon swap.disk

第四步:启动挂载swap分区

如果想开机后自动挂载swap分区,需要编辑/etc/fstab文件
sudo gedit /etc/fstab
打开文件后可以在文件末尾看到

#swap was on /dev/sda7 during installation
UUID=bc0df3aa-ceca-4275-b2d1-96d8968539ee none swap sw 0 0
这是当初装系统时产生的swap分区信息,只需要将“UUID=***”改成/swap/swap.disk,保存重启即可。
重启后打开终端输入free命令,即可查看swap分区的大小。

第五步:交换分区的优化

在终端输入“cat /proc/sys/vm/swappiness”命令可以查看系统默认的swappiness参数信息,默认值为60.解释一下swappiness参数,在ubuntu中该值的大小对如何使用swap分区有着很大的联系。swappiness=0,表示最大限度使用物理内存,然后才是swap分区,swappiness=100则表示积极使用swap分区,并且把内存上的数据及时的搬运到swap空间上。建议修该为10,具体操作如下:
sudo sysctl vm.swappiness=10
sudo gedit /etc/sysctl.conf
在文件末尾添加“vm.swappiness=10”,然后保存重启,设置完成。

ubuntu安装chrome

安装chrome
sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.t.d/
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt update
sudo apt install google-chrome-stable

基于xampp搭建dvwa

基于xampp搭建dvwa

XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.
官网: https://www.apachefriends.org/index.html
Damn Vulnerable Web Application (DVWA) is a PHP/MySQL web application that is damn vulnerable. Its main goal is to be an aid for security professionals to test their skills and tools in a legal environment, help web developers better understand the processes of securing web applications and to aid both students & teachers to learn about web application security in a controlled class room environment.
github: https://github.com/ethicalhack3r/DVWA

##安装xampp
到官网根据自己的系统下载相应的安装文件,下载后可根据提示一步步进入安装。

##配置Apache
由于Apache会与默认80端口产生冲突,所以要修改Apache的配置文件,软件打开后点击apache那一栏的Config,修改httpd.conf和httpd-ssl.conf的Listen属性改成与原来不一样的,之后点击上面Config中Service and port Settings 的 Main port和SSL port 改成与上一个一样的。

##下载dvwa
github: https://github.com/ethicalhack3r/DVWA
下载解压或 git clone https://github.com/ethicalhack3r/DVWA.git 复制到 C:\xampp\htdocs下

##配置dvwa
修改php目录下php.ini,找到allow_url_fopenallow_url_include设置成on

1
2
allow_url_fopen = On
allow_url_include = On